It makes it very difficult to debug the JavaScript when all whitespace is stripped out. The best thing to do if you are concerned about the extra download size of the web page (I am assuming this is the concern) is to make a separate page for the generic JavaScript functions. There is an example of this in the Validator webapp.
Creating a Separate Page for Static JavaScript If you want to just generate the dynamic JavaScript on you form page and have a separate page with the static JavaScript to take advantage of browser caching you can use the dynamicJavascript and staticJavascript attributes to the JavascriptValidatorTag. You can turn each attribute's generation of JavaScript on and off by putting in true or false (they default to true). Reference jsType.jsp and staticJavascript.jsp in the main example webapp for a working example. In your form page: <validator:javascript formName="typeForm" dynamicJavascript="true" staticJavascript="false"/> <script language="Javascript1.1" src="staticJavascript.jsp"></script> In your static JavaScript page. <%@ page contentType="application/x-javascript" %> <validator:javascript dynamicJavascript="false" staticJavascript="true"/> David --- Adolfo Miguelez <[EMAIL PROTECTED]> wrote: > > however, if, as you say, all are loaded in bundle, > is this not overhead for > the web server, since HTML generated pages are much > conger. Could not this > be optimized in validator framework? > > Just a sugestion, > > regards and thanks, > > Adolfo. > > >From: "Adolfo Miguelez" <[EMAIL PROTECTED]> > >Reply-To: "Struts Users Mailing List" > <[EMAIL PROTECTED]> > >To: [EMAIL PROTECTED] > >Subject: Re: R: validator generated HTML code > >Date: Tue, 28 May 2002 14:57:16 +0000 > > > > > >cheers daniele > > > >>From: "daniele rizzi" <[EMAIL PROTECTED]> > >>Reply-To: "Struts Users Mailing List" > <[EMAIL PROTECTED]> > >>To: "Struts Users Mailing List" > <[EMAIL PROTECTED]> > >>Subject: R: validator generated HTML code > >>Date: Tue, 28 May 2002 16:38:15 +0200 > >> > >> > >>Hi, > >>you're not the only one studying this stuff! As > far as I may know > >>(after 3 days & nigths of hard work) the answers > are: > >> > >>---q1 > >>--Can I get rid of the other functions? > >> > >>No, they're loaded in bundle, but you can always > get into > >>the validator-rule.xml and remove what you don't > like > >> > >>---q2 > >>--i notice that i get a lot of \n characters in > between the lines... > >> > >>oh, open the file with textpad and substitute any > \n\n with \n > >> > >>(maybe the writer worked on a pc, then sent the > code to a unix box, > >>so every \n became a \n\n) > >> > >>like it? > >>bye, daniele rizzi > >> > >> > >>-----Messaggio originale----- > >>Da: Adolfo Miguelez [mailto:[EMAIL PROTECTED]] > >>Inviato: marted́ 28 maggio 2002 16.25 > >>A: [EMAIL PROTECTED] > >>Oggetto: validator generated HTML code > >> > >> > >> > >>Hi All, > >> > >>i have been checking the validator framework and i > have some issues for > >>yuo. > >>First a, probably silly, question. I place in my > JSP: > >> onsubmit="return > validateLoginForm(this);" > >>in the <html:form> and > >> <html:javascript formName="LoginForm"/>. > >> > >>The result is that I am getting all the javascript > functions present in my > >>validator-rules.xml file in the generated HTML, > i.e: > >> > >>function validateShort(form) > >>function validateMask(form) > >>function validateCreditCard(form) > >>function validateEmail(form) > >>function validateMaxLength(form) > >>function validateDate(form) > >>function validateFloat(form) > >>function validateRange(form) > >>function validateMinLength(form) > >>function validateRequired(form) > >>function validateInteger(form) > >>function validateByte(form) > >> > >>I suppose, I should only get the necessary > functions for my validation, in > >>my case function validateRequired(form). What am I > doing wrong or missing? > >>Can I get rid of the other functions? > >> > >>Secondly, i notice that i get a lot of \n > characters in between the lines > >>of > >>the generated functions, i.e.: > >> > >>function validateRequired(form) { > >> > >> var bValid = true; > >> > >> var focusField = null; > >> > >> var i = 0; > >> > >> var fields = new Array(); > >> > >> oRequired = new required(); > >> > >> > >> > >> for (x in oRequired) { > >> > >> if > ((form[oRequired[x][0]].type == 'text' || > >>form[oRequired[x][0]].type == 'textarea' || > form[oRequired[x][0]].type == > >>'select-one' || form[oRequired[x][0]].type == > 'radio' || > >>form[oRequired[x][0]].type == 'password') && > form[oRequired[x][0]].value > >>== > >>'') { > >> > >> if (i == 0) > >> > >> focusField = > form[oRequired[x][0]]; > >> > >> > >> > >> fields[i++] = > oRequired[x][1]; > >> > >> > >> > >> bValid = false; > >> > >> } > >> > >> } > >> > >> > >> > >> if (fields.length > 0) { > >> > >> focusField.focus(); > >> > >> alert(fields.join('\n')); > >> > >> } > >> > >> > >> > >> return bValid; > >> > >> } > >> > >>Could this code generation be optimized in order > to get javascript > >>functions > >>with same format that in the validator-rules.xml? > >> > >> > >>Adolfo. > >> > >> > >> > >>_________________________________________________________________ > >>Get your FREE download of MSN Explorer at > >>http://explorer.msn.com/intl.asp. > >> > >> > >>-- > >>To unsubscribe, e-mail: > >><mailto:[EMAIL PROTECTED]> > >>For additional commands, e-mail: > >><mailto:[EMAIL PROTECTED]> > >> > >> > >> > >>-- > >>To unsubscribe, e-mail: > >><mailto:[EMAIL PROTECTED]> > >>For additional commands, e-mail: > >><mailto:[EMAIL PROTECTED]> > >> > > > === message truncated === __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>