i also have a similar use case that requires "turning off" validation for
some ajax button links

e.g.
i have a form, that may have some text fields with different/none validators

and i want to do "translation" on some of the text fields by
ajax/dynamically,
so i need to use ajax button links to "submit" the form with the latest
input values to backend logic

for this case, we want to supress the validation error (if any) and have
wicket to still propagate the form fields to our model automatically

we can't use "setdefaultformprocess" to false for the ajax button link

so i go to have a look at the form processing, and copy the wicket's form
property propagation logic to my form's onerror:

<code>
@Override
protected void onError() {
  // just for demonstration, can make it happen only for certain cases only
                
  // before updating, call the interception method for clients
  beforeUpdateFormComponentModels();

  // Update model using form data
  updateFormComponentModels();

  // Persist FormComponents if requested
  // private, can't call
// persistFormComponentData();
               
   super.onError();
}
</code>

there may be problem in propagating the form fields to model if there is
validation error,
but it looks ok to me because the form fields with no validation error
should still get their values submitted and propagated nicely, event some
other form fields may have validation error



noon wrote:
> 
> I solved similar problem where I had some required TextField components
> and an AJAX component which does a AJAX submit. During this AJAX submit I
> wanted to prohibit all the form validations. I achieved this by setting
> the AJAX components (an autocomplete TextField with custom AJAX behaviour)
> into its own nested form... form which is inside another form.
> 
> I'm not sure does this solve your problem. I found my solution just by
> trying differend solutions and it worked :)
> 
> 
> 
> hbf wrote:
>> 
>> I have a custom component that allows the user to select one or more
>> tags. For this, the component has a text field and an AjaxButton "Add"
>> to add a tag.
>> 
>> All works fine if I use the component in a form without validation
>> errors. If, however, a text field has setRequired(true), the
>> AjaxButton's onSubmit() method is not called (but onError() instead).
>> 
>> In this case, I do not want this behaviour but want form validation
>> to be disabled for the "Add" AjaxButton. (I still need to get the
>> model values updated, though.)
>> 
>> Is there an easy way to achieve this?
>> 
>> I've read about conditional validation,
>> 
>>    http://cwiki.apache.org/WICKET/conditional-validation.html
>> 
>> but as my component does not know about the enclosing form, I am
>> looking for another solution.
>> 
>> Many thanks,
>> Kaspar
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Turn-off-form-validation-tp21090395p21265480.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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

Reply via email to