From: René B. <bo...@sa...> - 2013-03-04 16:26:09
|
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 |