AjaxObserveField mandatory input fields
René Bock <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.wonder-disc |
|---|---|
| Message-ID | <[email protected]> |
Hi all,
I'm using a combination of AjaxObserveField and AjaxUpdateContainer to perform input validation and to display the appropriate error messages. E.g
< AjaxUpdateContainer id="foo">
<WOTextField id="bar"/>
< AjaxObserveField observeFieldID="bar" updateContainerID="foo">
<if condition = bar_has_invalid_value>
<displayErrors />
</if>
</AjaxUpdateContainer>
Usually, an AjaxObserveField will trigger an UpdateContainer only when the value of the observed field changes . The above construct works for me in all cases but one:
Let "bar" be a mandatory field. When the user sets the input focus to the field and leaves the field without setting any value, the AjaxObserveField won't fire and no error message will be displayed :-(
My first attempt to solve this, would be do to add a class "mandatory" to "bar" and change the behavior of AjaxObserveField to
fire if the bar.value has changed OR bar.class contains "mandatory" and bar.value is null
Now: is the there already a hook in AjaxObserveField to implement this or what would be the recommendet way to enhance AjaxObserveField in order to handle this (I guess not so uncommon) use case?
Any (other) hints are welcome!
regards,
René Bock
Software Engineering
--
salient doremus
http://www.salient.de http://www.openforms.de
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Wonder-disc mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wonder-disc