You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Kunal H. Parikh" <ku...@carsales.com.au> on 2004/03/14 22:55:08 UTC

Struts Validator prints all javascript functions

Hi All!

I am attempting to use Struts Validator.

All works well, but I am only using the "required" validation in my code.

However, the JavaScript that gets generated, include other functions like
checkEmail, minLength, etc. etc.

Is this expected behaviour?

My code (FYI):
=======================
<html:form name="vehicleEnquiry" action="/vehicleEnquiry.do" method="post"
type="org.apache.struts.validator.DynaValidatorActionForm" onsubmit="return(
validateVehicleEnquiry(this) );"  >

....

		<tr>
			<td><bean:message key="label.name" />:</td>
			<td> <html:text property="name" value="" /> </td>
		</tr>
....

<html:submit value="Send Enquiry" />
</html:form>
<html:javascript formName="vehicleEnquiry" />
======================

TIA,

Kunal



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


Re: Struts Validator prints all javascript functions

Posted by Theodosios Paschalidis <th...@hotmail.com>.
Hi Kunal,

I do not use Tiles nor the DynaValidator but I get the same in a certain
Form. I use Struts 1.1

Theo

----- Original Message ----- 
From: "Kunal H. Parikh" <ku...@carsales.com.au>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Sent: Monday, March 15, 2004 9:38 PM
Subject: RE: Struts Validator prints all javascript functions


Hi Guys !

Does anyone think that this could be happening because I am using Tiles ?


Kunal

-----Original Message-----
From: Kunal H. Parikh [mailto:kunalp@carsales.com.au]
Sent: Monday, 15 March 2004 10:12
To: 'Struts Users Mailing List'
Subject: RE: Struts Validator prints all javascript functions

I thought so too!

My struts-config.xml reads as follows
==========
..
<form-bean name="vehicleEnquiry"
type="org.apache.struts.validator.DynaValidatorActionForm">
<form-property name="vehicleId"
type="java.lang.Integer" />
<form-property name="fullName"
type="java.lang.String" />
</form-bean>
..
=========

Do you think DynaValidatorActionForm could be creating the problem ?


Kunal

-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of Marino A. Jonsson
Sent: Monday, 15 March 2004 10:07
To: struts-user@jakarta.apache.org
Subject: Re: Struts Validator prints all javascript functions

hmm ... that's not my experience - the dynamic parts are rendered as they
should, but all the static javascript is then rendered too (instead of just
the relevant static methods).  I haven't tested 1.2 though.

Marino

"Joe Germuska" <Jo...@Germuska.com> wrote in message
news:a0602040fbc7a8ad0f344@[192.168.0.3]...
> At 8:55 AM +1100 3/15/04, Kunal H. Parikh wrote:
> >Hi All!
> >
> >I am attempting to use Struts Validator.
> >
> >All works well, but I am only using the "required" validation in my code.
> >
> >However, the JavaScript that gets generated, include other functions like
> >checkEmail, minLength, etc. etc.
> >
> >Is this expected behaviour?
>
> This is what happens when the "formName" you specify in the
> html:javascript tag is not found by the validator.
>
> Since Struts 1.2.0 (and a little before in the nightlies, of course),
> this condition causes a JSPException to be thrown instead.
>
> Joe
>
>
> -- 
> Joe Germuska
> Joe@Germuska.com
> http://blog.germuska.com
>        "Imagine if every Thursday your shoes exploded if you tied them
> the usual way.  This happens to us all the time with computers, and
> nobody thinks of complaining."
>              -- Jef Raskin




---------------------------------------------------------------------
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





---------------------------------------------------------------------
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: Struts Validator prints all javascript functions

Posted by "Kunal H. Parikh" <ku...@carsales.com.au>.
Hi Guys !

Does anyone think that this could be happening because I am using Tiles ?


Kunal

-----Original Message-----
From: Kunal H. Parikh [mailto:kunalp@carsales.com.au] 
Sent: Monday, 15 March 2004 10:12
To: 'Struts Users Mailing List'
Subject: RE: Struts Validator prints all javascript functions

I thought so too!

My struts-config.xml reads as follows
==========
...
		<form-bean name="vehicleEnquiry"
type="org.apache.struts.validator.DynaValidatorActionForm">
			<form-property name="vehicleId"
type="java.lang.Integer" />
			<form-property name="fullName"
type="java.lang.String" />
		</form-bean>
...
=========

Do you think DynaValidatorActionForm could be creating the problem ?


Kunal

-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of Marino A. Jonsson
Sent: Monday, 15 March 2004 10:07
To: struts-user@jakarta.apache.org
Subject: Re: Struts Validator prints all javascript functions

hmm ... that's not my experience - the dynamic parts are rendered as they
should, but all the static javascript is then rendered too (instead of just
the relevant static methods).  I haven't tested 1.2 though.

Marino

"Joe Germuska" <Jo...@Germuska.com> wrote in message
news:a0602040fbc7a8ad0f344@[192.168.0.3]...
> At 8:55 AM +1100 3/15/04, Kunal H. Parikh wrote:
> >Hi All!
> >
> >I am attempting to use Struts Validator.
> >
> >All works well, but I am only using the "required" validation in my code.
> >
> >However, the JavaScript that gets generated, include other functions like
> >checkEmail, minLength, etc. etc.
> >
> >Is this expected behaviour?
>
> This is what happens when the "formName" you specify in the
> html:javascript tag is not found by the validator.
>
> Since Struts 1.2.0 (and a little before in the nightlies, of course),
> this condition causes a JSPException to be thrown instead.
>
> Joe
>
>
> -- 
> Joe Germuska
> Joe@Germuska.com
> http://blog.germuska.com
>        "Imagine if every Thursday your shoes exploded if you tied them
> the usual way.  This happens to us all the time with computers, and
> nobody thinks of complaining."
>              -- Jef Raskin




---------------------------------------------------------------------
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





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


RE: Struts Validator prints all javascript functions

Posted by "Kunal H. Parikh" <ku...@carsales.com.au>.
I thought so too!

My struts-config.xml reads as follows
==========
...
		<form-bean name="vehicleEnquiry"
type="org.apache.struts.validator.DynaValidatorActionForm">
			<form-property name="vehicleId"
type="java.lang.Integer" />
			<form-property name="fullName"
type="java.lang.String" />
		</form-bean>
...
=========

Do you think DynaValidatorActionForm could be creating the problem ?


Kunal

-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of Marino A. Jonsson
Sent: Monday, 15 March 2004 10:07
To: struts-user@jakarta.apache.org
Subject: Re: Struts Validator prints all javascript functions

hmm ... that's not my experience - the dynamic parts are rendered as they
should, but all the static javascript is then rendered too (instead of just
the relevant static methods).  I haven't tested 1.2 though.

Marino

"Joe Germuska" <Jo...@Germuska.com> wrote in message
news:a0602040fbc7a8ad0f344@[192.168.0.3]...
> At 8:55 AM +1100 3/15/04, Kunal H. Parikh wrote:
> >Hi All!
> >
> >I am attempting to use Struts Validator.
> >
> >All works well, but I am only using the "required" validation in my code.
> >
> >However, the JavaScript that gets generated, include other functions like
> >checkEmail, minLength, etc. etc.
> >
> >Is this expected behaviour?
>
> This is what happens when the "formName" you specify in the
> html:javascript tag is not found by the validator.
>
> Since Struts 1.2.0 (and a little before in the nightlies, of course),
> this condition causes a JSPException to be thrown instead.
>
> Joe
>
>
> -- 
> Joe Germuska
> Joe@Germuska.com
> http://blog.germuska.com
>        "Imagine if every Thursday your shoes exploded if you tied them
> the usual way.  This happens to us all the time with computers, and
> nobody thinks of complaining."
>              -- Jef Raskin




---------------------------------------------------------------------
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: Struts Validator prints all javascript functions

Posted by "Marino A. Jonsson" <ma...@hotmail.com>.
hmm ... that's not my experience - the dynamic parts are rendered as they
should, but all the static javascript is then rendered too (instead of just
the relevant static methods).  I haven't tested 1.2 though.

Marino

"Joe Germuska" <Jo...@Germuska.com> wrote in message
news:a0602040fbc7a8ad0f344@[192.168.0.3]...
> At 8:55 AM +1100 3/15/04, Kunal H. Parikh wrote:
> >Hi All!
> >
> >I am attempting to use Struts Validator.
> >
> >All works well, but I am only using the "required" validation in my code.
> >
> >However, the JavaScript that gets generated, include other functions like
> >checkEmail, minLength, etc. etc.
> >
> >Is this expected behaviour?
>
> This is what happens when the "formName" you specify in the
> html:javascript tag is not found by the validator.
>
> Since Struts 1.2.0 (and a little before in the nightlies, of course),
> this condition causes a JSPException to be thrown instead.
>
> Joe
>
>
> -- 
> Joe Germuska
> Joe@Germuska.com
> http://blog.germuska.com
>        "Imagine if every Thursday your shoes exploded if you tied them
> the usual way.  This happens to us all the time with computers, and
> nobody thinks of complaining."
>              -- Jef Raskin




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


Re: Struts Validator prints all javascript functions

Posted by Joe Germuska <Jo...@Germuska.com>.
At 8:55 AM +1100 3/15/04, Kunal H. Parikh wrote:
>Hi All!
>
>I am attempting to use Struts Validator.
>
>All works well, but I am only using the "required" validation in my code.
>
>However, the JavaScript that gets generated, include other functions like
>checkEmail, minLength, etc. etc.
>
>Is this expected behaviour?

This is what happens when the "formName" you specify in the 
html:javascript tag is not found by the validator.

Since Struts 1.2.0 (and a little before in the nightlies, of course), 
this condition causes a JSPException to be thrown instead.

Joe


-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
       "Imagine if every Thursday your shoes exploded if you tied them 
the usual way.  This happens to us all the time with computers, and 
nobody thinks of complaining."
             -- Jef Raskin

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


RE: [SOLVED] Struts Validator prints all javascript functions

Posted by "Kunal H. Parikh" <ku...@carsales.com.au>.
Whoops ................. that didn't quite solve the problem ..... the real
javascript methods are not quite being appended to the response .....

My apologies!



-----Original Message-----
From: Kunal H. Parikh [mailto:kunalp@carsales.com.au] 
Sent: Thursday, 18 March 2004 12:11
To: 'Struts Users Mailing List'
Cc: 'Joe Germuska'; 'Theodosios Paschalidis'
Subject: RE: [SOLVED] Struts Validator prints all javascript functions 

Hi All!

After some debugging, I worked out that there are two variables
"dynamicJavaScript" and "staticJavaScript" in the JavascriptValidatorTag
class.

By default, their values are "true". And Hence, the staticJavaScript also
gets included in the response.

i.e. to only display relevant JS methods, your <html:javascript> tag should
look like,

========
<html:javascript formName="myformName" dynamicJavascript="true"
staticJavascript="false" />
========

cheers,

kunal


-----Original Message-----
From: Kunal H. Parikh [mailto:kunalp@carsales.com.au] 
Sent: Monday, 15 March 2004 08:55
To: 'Struts Users Mailing List'
Subject: Struts Validator prints all javascript functions

Hi All!

I am attempting to use Struts Validator.

All works well, but I am only using the "required" validation in my code.

However, the JavaScript that gets generated, include other functions like
checkEmail, minLength, etc. etc.

Is this expected behaviour?

My code (FYI):
=======================
<html:form name="vehicleEnquiry" action="/vehicleEnquiry.do" method="post"
type="org.apache.struts.validator.DynaValidatorActionForm" onsubmit="return(
validateVehicleEnquiry(this) );"  >

....

		<tr>
			<td><bean:message key="label.name" />:</td>
			<td> <html:text property="name" value="" /> </td>
		</tr>
....

<html:submit value="Send Enquiry" />
</html:form>
<html:javascript formName="vehicleEnquiry" />
======================

TIA,

Kunal



---------------------------------------------------------------------
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





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


RE: [SOLVED] Struts Validator prints all javascript functions

Posted by "Kunal H. Parikh" <ku...@carsales.com.au>.
Hi All!

After some debugging, I worked out that there are two variables
"dynamicJavaScript" and "staticJavaScript" in the JavascriptValidatorTag
class.

By default, their values are "true". And Hence, the staticJavaScript also
gets included in the response.

i.e. to only display relevant JS methods, your <html:javascript> tag should
look like,

========
<html:javascript formName="myformName" dynamicJavascript="true"
staticJavascript="false" />
========

cheers,

kunal


-----Original Message-----
From: Kunal H. Parikh [mailto:kunalp@carsales.com.au] 
Sent: Monday, 15 March 2004 08:55
To: 'Struts Users Mailing List'
Subject: Struts Validator prints all javascript functions

Hi All!

I am attempting to use Struts Validator.

All works well, but I am only using the "required" validation in my code.

However, the JavaScript that gets generated, include other functions like
checkEmail, minLength, etc. etc.

Is this expected behaviour?

My code (FYI):
=======================
<html:form name="vehicleEnquiry" action="/vehicleEnquiry.do" method="post"
type="org.apache.struts.validator.DynaValidatorActionForm" onsubmit="return(
validateVehicleEnquiry(this) );"  >

....

		<tr>
			<td><bean:message key="label.name" />:</td>
			<td> <html:text property="name" value="" /> </td>
		</tr>
....

<html:submit value="Send Enquiry" />
</html:form>
<html:javascript formName="vehicleEnquiry" />
======================

TIA,

Kunal



---------------------------------------------------------------------
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