You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ivo Zivkov <iz...@ci.ods.org> on 2003/05/23 22:38:25 UTC

Undefined variable validating form.

I am getting the following error in the Javascript console when I submit a
form. I have a form.

==============================================
http://linuxserver:8081/ci-storefront/action/getShippingInfo
Event thread: onsubmit
Error:
name: ReferenceError
message: Statement on line 1: Reference to undefined variable: No such
variable 'validateShippingForm'
Backtrace:
  In unknown script
    return validateShippingForm(this);
  At unknown location
    {event handler trampoline}

I have a form bean “shoppingForm”, and am trying to validate it by calling
'validateShippingForm'(this). Actually, I get similar error for every form I
have. This used to work before, and I cannot understand what I am missing
now.

Your help would be appreciated.

Regards,
Ivo Zivkov
www.ci-devices.com <http://www.ci-devices.com/>


Re: Undefined variable validating form.

Posted by Ted Husted <hu...@apache.org>.
JavaScript is client-side. One the page is rendered as HTML, the 
framework or tags are no longer involved. The answer has to be in the 
rendered page, since that's the only thing being processed at this point.

Ivo Zivkov wrote:
> Ted, thanks for your help.
> 
> I can see the javascript function being generated in the browser's source
> like this:
> 
> <!-- Begin
> 
>      var bCancel = false;
> 
>     function validateShippingForm(form)
> 
>         if (bCancel)
>       return true;
>         else
>        return validateRequired(form) && validateMask(form) &&
> validateMaxLength(form) && validateDate(form) && validateCreditCard(form);
>    }
> 
> ...
> 
> But the javascript console is still reporting:
> 
> name: ReferenceError
> message: Statement on line 1: Reference to undefined variable: No such
> variable 'validateShippingForm'
> Backtrace:
>   In unknown script
>     return validateShippingForm(this);
>   At unknown location
>     {event handler trampoline}
> 
> and the form is not validated.
> 
> I have included commons-validator.jar. Am is missing something else.
> 
> Tanks and Regards,
> Ivo Zivkov
> www.ci-devices.com
> 
> 
> -----Original Message-----
> From: Ted Husted [mailto:husted@apache.org]
> Sent: Friday, May 23, 2003 4:48 PM
> To: Struts Users Mailing List
> Subject: Re: Undefined variable validating form.
> 
> Check the browser source to be sure that the validator tag is spitting
> out the JavaScript. If not, be sure the taglib is still being imported
> and that the validation.xml is still being loaded at startup.
> 
> -Ted.
> 
> Ivo Zivkov wrote:
> 
>>I am getting the following error in the Javascript console when I submit a
>>form. I have a form.
>>
>>==============================================
>>http://linuxserver:8081/ci-storefront/action/getShippingInfo
>>Event thread: onsubmit
>>Error:
>>name: ReferenceError
>>message: Statement on line 1: Reference to undefined variable: No such
>>variable 'validateShippingForm'
>>Backtrace:
>>  In unknown script
>>    return validateShippingForm(this);
>>  At unknown location
>>    {event handler trampoline}
>>
>>I have a form bean "shoppingForm", and am trying to validate it by calling
>>'validateShippingForm'(this). Actually, I get similar error for every form
> 
> I
> 
>>have. This used to work before, and I cannot understand what I am missing
>>now.
>>
>>Your help would be appreciated.
>>
>>Regards,
>>Ivo Zivkov
>>www.ci-devices.com <http://www.ci-devices.com/>
>>
>>
> 
> 
> --
> Ted Husted,
> Struts in Action <http://husted.com/struts/book.html>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 


-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Undefined variable validating form.

Posted by Ivo Zivkov <iz...@ci.ods.org>.
Ted, thanks for your help.

I can see the javascript function being generated in the browser's source
like this:

<!-- Begin

     var bCancel = false;

    function validateShippingForm(form)

        if (bCancel)
      return true;
        else
       return validateRequired(form) && validateMask(form) &&
validateMaxLength(form) && validateDate(form) && validateCreditCard(form);
   }

...

But the javascript console is still reporting:

name: ReferenceError
message: Statement on line 1: Reference to undefined variable: No such
variable 'validateShippingForm'
Backtrace:
  In unknown script
    return validateShippingForm(this);
  At unknown location
    {event handler trampoline}

and the form is not validated.

I have included commons-validator.jar. Am is missing something else.

Tanks and Regards,
Ivo Zivkov
www.ci-devices.com


-----Original Message-----
From: Ted Husted [mailto:husted@apache.org]
Sent: Friday, May 23, 2003 4:48 PM
To: Struts Users Mailing List
Subject: Re: Undefined variable validating form.

Check the browser source to be sure that the validator tag is spitting
out the JavaScript. If not, be sure the taglib is still being imported
and that the validation.xml is still being loaded at startup.

-Ted.

Ivo Zivkov wrote:
> I am getting the following error in the Javascript console when I submit a
> form. I have a form.
>
> ==============================================
> http://linuxserver:8081/ci-storefront/action/getShippingInfo
> Event thread: onsubmit
> Error:
> name: ReferenceError
> message: Statement on line 1: Reference to undefined variable: No such
> variable 'validateShippingForm'
> Backtrace:
>   In unknown script
>     return validateShippingForm(this);
>   At unknown location
>     {event handler trampoline}
>
> I have a form bean "shoppingForm", and am trying to validate it by calling
> 'validateShippingForm'(this). Actually, I get similar error for every form
I
> have. This used to work before, and I cannot understand what I am missing
> now.
>
> Your help would be appreciated.
>
> Regards,
> Ivo Zivkov
> www.ci-devices.com <http://www.ci-devices.com/>
>
>


--
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Undefined variable validating form.

Posted by Ted Husted <hu...@apache.org>.
Check the browser source to be sure that the validator tag is spitting 
out the JavaScript. If not, be sure the taglib is still being imported 
and that the validation.xml is still being loaded at startup.

-Ted.

Ivo Zivkov wrote:
> I am getting the following error in the Javascript console when I submit a
> form. I have a form.
> 
> ==============================================
> http://linuxserver:8081/ci-storefront/action/getShippingInfo
> Event thread: onsubmit
> Error:
> name: ReferenceError
> message: Statement on line 1: Reference to undefined variable: No such
> variable 'validateShippingForm'
> Backtrace:
>   In unknown script
>     return validateShippingForm(this);
>   At unknown location
>     {event handler trampoline}
> 
> I have a form bean “shoppingForm”, and am trying to validate it by calling
> 'validateShippingForm'(this). Actually, I get similar error for every form I
> have. This used to work before, and I cannot understand what I am missing
> now.
> 
> Your help would be appreciated.
> 
> Regards,
> Ivo Zivkov
> www.ci-devices.com <http://www.ci-devices.com/>
> 
> 


-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org