struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <davelnew...@gmail.com>
Subject Re: additional onsubmit javascript validation
Date Thu, 23 Sep 2010 21:17:21 GMT
(And binding an event to onclick or onsubmit doesn't mean that existing
handlers have to go away, depending on how you do it, or if you save
existing handlers.)

On Thu, Sep 23, 2010 at 1:51 PM, Dale Newfield <dale@newfield.org> wrote:

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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message