struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Taylor" <rtay...@dtgresults.com>
Subject Re: additional onsubmit javascript validation
Date Fri, 24 Sep 2010 01:36:12 GMT
Hi Dale,

I'm just using the xhtml theme, but I missed that chunk of code in 
xhtml/form-validate.ftl.
That's what I needed.

Thanks,

/robert

----- Original Message ----- 
From: "Dale Newfield" <dale@newfield.org>
To: "Struts Users Mailing List" <user@struts.apache.org>
Cc: "Robert Taylor" <rtaylor@dtgresults.com>
Sent: Thursday, September 23, 2010 1:51 PM
Subject: Re: additional onsubmit javascript validation


> On 9/23/10 7:48 AM, Robert Taylor wrote:
>> I'm not sure modifying the templates will work here.
>
> css_xhtml/form-validate.ftl contains:
>
>     <#if parameters.onsubmit??>
>         ${tag.addParameter('onsubmit', "${parameters.onsubmit}; return 
> validateForm_${parameters.id}();")}
>     <#else>
>         ${tag.addParameter('onsubmit', "return 
> validateForm_${parameters.id}();")}
>     </#if>
>
> If you override that file and change one line like so:
>
>     <#if parameters.onsubmit??>
>         ${tag.addParameter('onsubmit', "return 
> (validateForm_${parameters.id}() && ${parameters.onsubmit});")}
>     <#else>
>         ${tag.addParameter('onsubmit', "return 
> validateForm_${parameters.id}();")}
>     </#if>
>
> and make your onsubmit attribute just be javascript that generates a 
> true/false value (FOO) instead of "return FOO", then I think you'll get 
> what you want.
>
> -Dale
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


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


Mime
View raw message