You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Poon, Johnny" <Jo...@ANICO.com> on 2003/07/07 17:38:59 UTC

Validator using instead of

Hi,

I'm using trying to use ValidatorActionForm and tile, but the submit button
is outside of the  form on a different JSP, therefore, I need to submit my
form indirectly using a link and javascript (see code below).  Neither the
client-side javascript nor the server-side validation get called.  But if I
hardcode a submit button WITHIN the form, the javascript will get called.

So, does this mean that validator will not work with
document.forms[0].submit(); ?  Is there a workaround this?  I'm sure there
are someone out there doing similar thing.

Thanks!

JP



My action form:

     <html:form action="/enterAppInfo1"
onsubmit="validateEnterAppInfo1(this);">
          <html:errors />&nbsp;
          <html:select property="primAddrState"
onchange='runSelectOnChange();'>
             <html:optionsCollection label="label" value="value" name="..."
property="..." />
          </html:select>
     </html:form>

     <html:javascript formName="enterAppInfo1" />


     <!-- Assuming one form per page, in the end of
doSomethingBeforeSubmit(...), I'm calling: -->
     <!-- document.forms[0].submit(); -->
     <A href="javascript:doSomethingBeforeSubmit(...);"/>
          <IMG name="..." src="..."
           onmouseover="javascript:submitChoiceOnMouseOver(...);return
true;"
           onmouseout="javascript:submitChoiceOnMouseOut(...);return true;"
           alt="....." border="0"></A>

My validation.xml:

	<formset>
		<form name="enterAppInfo1">
			<field property="primAddrState" depends="required">
				<msg name="required"
key="errors.state.required" />
			</field>
		</form>
	</formset>


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************


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


Re: Validator using instead of

Posted by Sandeep Takhar <sa...@yahoo.com>.
should it be a validatorForm?

sandeep
--- "Poon, Johnny" <Jo...@ANICO.com> wrote:
> Hi,
> 
> I'm using trying to use ValidatorActionForm and
> tile, but the submit button
> is outside of the  form on a different JSP,
> therefore, I need to submit my
> form indirectly using a link and javascript (see
> code below).  Neither the
> client-side javascript nor the server-side
> validation get called.  But if I
> hardcode a submit button WITHIN the form, the
> javascript will get called.
> 
> So, does this mean that validator will not work with
> document.forms[0].submit(); ?  Is there a workaround
> this?  I'm sure there
> are someone out there doing similar thing.
> 
> Thanks!
> 
> JP
> 
> 
> 
> My action form:
> 
>      <html:form action="/enterAppInfo1"
> onsubmit="validateEnterAppInfo1(this);">
>           <html:errors />&nbsp;
>           <html:select property="primAddrState"
> onchange='runSelectOnChange();'>
>              <html:optionsCollection label="label"
> value="value" name="..."
> property="..." />
>           </html:select>
>      </html:form>
> 
>      <html:javascript formName="enterAppInfo1" />
> 
> 
>      <!-- Assuming one form per page, in the end of
> doSomethingBeforeSubmit(...), I'm calling: -->
>      <!-- document.forms[0].submit(); -->
>      <A
> href="javascript:doSomethingBeforeSubmit(...);"/>
>           <IMG name="..." src="..."
>           
>
onmouseover="javascript:submitChoiceOnMouseOver(...);return
> true;"
>           
>
onmouseout="javascript:submitChoiceOnMouseOut(...);return
> true;"
>            alt="....." border="0"></A>
> 
> My validation.xml:
> 
> 	<formset>
> 		<form name="enterAppInfo1">
> 			<field property="primAddrState"
> depends="required">
> 				<msg name="required"
> key="errors.state.required" />
> 			</field>
> 		</form>
> 	</formset>
> 
> 
>
**********************************************************************
> This email and any files transmitted with it are
> confidential and
> intended solely for the use of the individual or
> entity to whom they
> are addressed. If you have received this email in
> error please notify
> the system manager.
>
**********************************************************************
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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