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]> > _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>