Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-18 Thread Daniel Stoch
I need to pass any value (null or not null) to a model without validation. So I cannot call validate() but only convertInput() (as you can see for example in DropDownChoice). To do this inside a behavior class convertInput() method must be public (or I need to hack this using a reflection, but this

Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-18 Thread Pedro Santos
On Thu, Feb 17, 2011 at 8:32 PM, Daniel Stoch wrote: > On Thu, Feb 17, 2011 at 10:37 PM, Igor Vaynberg > wrote: > > validation is there to make sure the user of the webapp cannot push an > > illegal value into a model. it doesnt matter if its just the component > > that is being submitted or the

Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-18 Thread Pedro Santos
Do your use case needs to convert a null input? If the input is differs from null FormComponent#validate will be just fine. On Fri, Feb 18, 2011 at 5:20 PM, Daniel Stoch wrote: > On Fri, Feb 18, 2011 at 10:09 AM, Daniel Stoch > wrote: > > > > > My post was only a proposal, because it is not pos

Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-18 Thread Daniel Stoch
On Fri, Feb 18, 2011 at 10:09 AM, Daniel Stoch wrote: > > My post was only a proposal, because it is not possible to easy extend > AjaxFormComponentUpdatingBehavior because onEvent() is final. I want > to avoid copy/paste code with only a little change. And I think this > change is very useful. B

Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-18 Thread Daniel Stoch
It can be called with null value when you set DropDownChoice.setNullValid(true). You don't want to understand that this is a good behavior in many cases, not a bug. But ok it is your framework, so you decide. But maybe other Wicket commiters have a different feeling about it? -- Daniel On Fri, Fe

Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-18 Thread Igor Vaynberg
that looks like a bug to me. the reason it has gone unnoticed for so long is that someone would have to hack html to cause it. onchange only fires in browsers when there is a value selected, so that code would not typically be called with a null, and thus no need to check required. -igor On Fri,

Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-18 Thread Daniel Stoch
On Thu, Feb 17, 2011 at 10:37 PM, Igor Vaynberg wrote: > validation is there to make sure the user of the webapp cannot push an > illegal value into a model. it doesnt matter if its just the component > that is being submitted or the entire form. components decide whether > or not a user can push

Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-18 Thread Daniel Stoch
>> Maybe I should explain one of use-cases. Let's say we have a form to >> enter RSS feed information. There are two TextFields: >> - url for RSS feed (urlModel) >> - custom RSS feed name (nameModel). >> Both are required and both have OnChangeBehavior attached. When user >> enter url for RSS the n

Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Igor Vaynberg
On Thu, Feb 17, 2011 at 2:32 PM, Daniel Stoch wrote: > On Thu, Feb 17, 2011 at 10:37 PM, Igor Vaynberg > wrote: >> validation is there to make sure the user of the webapp cannot push an >> illegal value into a model. it doesnt matter if its just the component >> that is being submitted or the en

Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Daniel Stoch
On Thu, Feb 17, 2011 at 10:37 PM, Igor Vaynberg wrote: > validation is there to make sure the user of the webapp cannot push an > illegal value into a model. it doesnt matter if its just the component > that is being submitted or the entire form. components decide whether > or not a user can push

Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Martin Makundi
Also conditional validation might do it: https://cwiki.apache.org/WICKET/conditional-validation.html 2011/2/17 Igor Vaynberg : > validation is there to make sure the user of the webapp cannot push an > illegal value into a model. it doesnt matter if its just the component > that is being submitted

Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Igor Vaynberg
validation is there to make sure the user of the webapp cannot push an illegal value into a model. it doesnt matter if its just the component that is being submitted or the entire form. components decide whether or not a user can push null in by using their required flag. you want to push null, don

Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Daniel Stoch
On Thu, Feb 17, 2011 at 10:01 PM, Igor Vaynberg wrote: > if you want to push a null value into a component you marked required > then dont mark it as required. No, because then I must have my own "customrequired" flags instead of using the core mechanism. I think this is wrong way. There is a wro

Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Igor Vaynberg
if you want to push a null value into a component you marked required then dont mark it as required. if you have inter-dependent validation use a formvalidator or override form's onsubmit. -igor On Thu, Feb 17, 2011 at 8:51 AM, Daniel Stoch wrote: > There is a situation when the AjaxFormCompone

Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Daniel Stoch
On Thu, Feb 17, 2011 at 9:02 PM, Pedro Santos wrote: > Override onError still makes sense for me, if the form component is > required, why to hide the message? Because I don't want to show such error message when user clears (update) this required field but only when he press Submit. And Feedback

Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Pedro Santos
Override onError still makes sense for me, if the form component is required, why to hide the message? If there is some special message reporting rule, it can be coded inside onError also. On Thu, Feb 17, 2011 at 5:26 PM, Daniel Stoch wrote: > On Thu, Feb 17, 2011 at 6:50 PM, Pedro Santos wrote:

Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Daniel Stoch
On Thu, Feb 17, 2011 at 6:50 PM, Pedro Santos wrote: > I Daniel, how alwaysUpdateModel differs from updateModel? You mean "from getUpdateModel()"? isAlwaysUpdateModel() is called only when component is invalid, but getUpdateModel() in both cases (for valid and invalid). > If you have an > requir

Re: Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Pedro Santos
I Daniel, how alwaysUpdateModel differs from updateModel? If you have an required form component that support some clean up logic, it can be coded inside AjaxFormComponentUpdatingBehavior#onError, and if you need an AJAX behavior that don't validate the form component, you can use AjaxEventBehavior

Extend AjaxFormComponentUpdatingBehavior functionality for required FormComponents

2011-02-17 Thread Daniel Stoch
There is a situation when the AjaxFormComponentUpdatingBehavior deafult functionality fails. When we want to attach this behavior (or OnChangeAjaxBehavior) to reflect changes inside a Model of FormComponent which is marked as REQUIRED event if user clears component input. In such situation AjaxForm