You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by jchappelle <jc...@4redi.com> on 2011/09/29 16:55:12 UTC

Detect dirty text field

Hi,

I have a behavior that changes the background color of a TextField if the
user presses any keys. It does this by changing the className in the dom.
This works fine but the problem I have is that when I have a form that
submits via Ajax I need to remove the added className. Currently if I
override Form.onSubmit and check the RequestCycle.get().getRequestTarget()
to see if it is Ajax then I can call appendJavascript. That is messy and the
logic is not all contained in my behavior. 

Any ideas would be greatly appreciated.

Thanks,

Josh

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Detect-dirty-text-field-tp3856096p3856096.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Detect dirty text field

Posted by Igor Vaynberg <ig...@gmail.com>.
you can do all this clientside, add an onsubmit listener to the form
and clear out the class...

-igor

On Thu, Sep 29, 2011 at 7:55 AM, jchappelle <jc...@4redi.com> wrote:
> Hi,
>
> I have a behavior that changes the background color of a TextField if the
> user presses any keys. It does this by changing the className in the dom.
> This works fine but the problem I have is that when I have a form that
> submits via Ajax I need to remove the added className. Currently if I
> override Form.onSubmit and check the RequestCycle.get().getRequestTarget()
> to see if it is Ajax then I can call appendJavascript. That is messy and the
> logic is not all contained in my behavior.
>
> Any ideas would be greatly appreciated.
>
> Thanks,
>
> Josh
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Detect-dirty-text-field-tp3856096p3856096.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org