struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Steele" <brian_ste...@paintedword.com>
Subject struts submitting form when validating javascript
Date Fri, 26 Jul 2002 15:36:56 GMT
Hi all,

Thanks in advance for any help.

Has anyone encountered an instance in which struts 1.0.2 submits a form without a submit button
or a javascript call to submit()?

I'm using javascript to validate my form.  This is an extensive library of validation functions
i've built up over many years and is fully tested, reliable, etc.  In short, i recurse through
the javascript DOM to find any fields that require validation.  If the required fields pass
the validation, I call "document.forms[ xx].submit()" otherwise an error message is displayed
via an alert popup and no call to submit is made.

Somehow Struts is submitting the form anyway, even when I have no submit button or js call
to submit ANYWHERE on the page.  The server logs show that struts starts processing the post
after the javascript finishes (and no submit is called).

I'm running this on JRun 3.1

Here's the relevant code:

<html:form action="updateEmployee">
...
...
...
<html:image src="images/send.gif" alt="Send" onclick="javascript:validateForm( '3' );"
/> **** 3 is the dom order of the form (4th form on page)****

</html:form>

---struts log ----- (reverse chronological)

07/26 11:13:59 info (JRun) payroll: Looking for Action instance for class com.xxx.payroll.action.UpdateEmployeePlanAction

  [1176]   07/26 11:13:59 info (JRun) payroll: No errors detected, accepting input 
  [1175]   07/26 11:13:59 info (JRun) payroll: Validating input form properties 
  [1174]   07/26 11:13:59 info (JRun) payroll: Populating bean properties from this request

  [1173]   07/26 11:13:59 info (JRun) payroll: Storing instance under attribute 'employeePlanForm'
in scope 'request' 
  [1172]   07/26 11:13:59 info (JRun) payroll: Creating new ActionForm instance of class 'com.xxx.payroll.form.EmployeePlanForm'

  [1171]   07/26 11:13:59 info (JRun) payroll: Looking for ActionForm bean under attribute
'employeePlanForm' 
  [1170]

-Brian
   

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


Mime
View raw message