> -----Original Message----- > From: Erik Weber [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 11, 2004 4:17 PM > To: Struts Users Mailing List > Subject: Re: html:javascript problem > > > Jim, I assume you meant > > <html:javascript formName="blah"/> > > and not > > <validator:javascript formName="blah"/> > > right?
Well.. I copied mine out of Struts In Action, so yours is probably right.. :) > > I tried this to no effect. > > I have > > <html:form action="${myAction}" onsubmit="return > validateFooForm(this)"> > . . . > </html:form> > <html:javascript formName="fooForm"/><!-- this renders the function > definition as validateFooForm(form) --> > > Still no worky . . . Did I misunderstand you? No, the key bit of magic it looked like you were missing was the onsubmit bit of magic. So, whatever puts the validateBlahForm(this) on the page is what you want.. and then call it.. Considering that SIA is an interesting mix of 1.1 and 1.2.... you might want to look at the javascript being generated and make sure the you're onsubmit is calling the right javascript function. > > Erik > > > > Jim Barrows wrote: > > > > > > >>-----Original Message----- > >>From: Erik Weber [mailto:[EMAIL PROTECTED] > >>Sent: Wednesday, August 11, 2004 3:51 PM > >>To: Struts Users Mailing List > >>Subject: html:javascript problem > >> > >> > >>I am using the validator plugin, specifying all my validation in > >>validation.xml. > >> > >>I want to use the automatic javascript generation feature to add > >>client-side validation. > >> > >>My form page is basically like this: > >> > >>. . . > >> > >><html:javascript formName="fooForm"/> > >> > >> > > > >This one is not easy to find... which sucks.. I knew what I > was looking for and couldn't find it.. anyway... > > > ><html:form action="/blah" onsubmit="return validateLogonForm(this)"> > >blah blah > ></html:form > ><validator:javascript formName="blah"/> > > > > > > > > > > > > > >>. . . > >> > >><form action="${myAction}" onsubmit="return validateFooForm(this)"> > >> > >>When the page is rendered, I can view source and see the javascript > >>function is seemingly properly rendered, and the function > >>name matches > >>up with that called in the onsubmit attribute, yet if I > >>submit a blank > >>form, I don't get any alerts -- the form submits. > >> > >>I'm not sure how to debug this since the javascript is generated > >>dynamically; I suppose I could edit validator-rules.xml to > >>put alerts in? > >> > >>Anything I am obviously doing wrong or forgetting here? I'm > not very > >>good with javascript, but I was hoping to avoid pasting the > function > >>because it's quite lengthy. > >> > >>I tried moving the html:javascript tag around to different > >>places -- at > >>the top of the page, just above the form, just inside the > >>form, doesn't > >>seem to make any difference. I do have other (non-generated) > >>javascript > >>functions working. > >> > >>If you don't see anything wrong so far I'll paste a snip of > the page > >>source from the browser (Mozilla 1.7). > >> > >> > >>Erik > >> > >> > >>------------------------------------------------------------ > --------- > >>To unsubscribe, e-mail: [EMAIL PROTECTED] > >>For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > >> > >> > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]