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 01:44:28 GMT
I modified the templates to allow pages to inject their own validation
messages. Unfortunately I never checked this in. You could do it with a
JavaScript framework, though, through binding.

Dave

On Wed, Sep 22, 2010 at 9:26 PM, Robert Taylor <rtaylor@dtgresults.com>wrote:

> Greetings,
>
> I'm using Struts2.2.1 and have a form using the xhtml theme which performs
> some simple javascript validation (required, etc...).
> Works great.
> Now, after the simple javascript validation executes I would like to add
> some more validation to the onsubmit event.
> Apart from modifying a template, I couldn't see how this could be achieved
> easily.
> If you include the validation in the form onsubmit attribute, it is
> prepended to the dynamically generated javascript validation function name.
>
> For example:
> <s:form action="MyAction" namespace="/mynamespace" theme="xhtml"
> validate="true" onsubmit="return myValidation()">
>
> produces the following markup.
>
> <form id="Myaction"
>         name="MyAction"
>         onsubmit="return myValidation(); return validateForm_MyAction();"
>         action="/scname/mynamespace/MyAction.html" method="post"
>         onreset="clearErrorMessages(this);clearErrorLabels(this);">
>
> As is evident, this won't work for me.
>
> I want to leverage the dynamically generated Javascript validation when
> validate="true". If that validation succeeds, then I want to execute some
> proprietary validation.
>
> I also know the name of the dynamically generated javascript method so I
> could call it in myValidation();
>
>
> Any suggestions would be appreciated.
>
> Thanks,
>
> /robert
>
>
>

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