You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Erik Weber <er...@mindspring.com> on 2004/08/12 00:51:22 UTC

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

. . .

<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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org