Re: pass error in submit method

2021-06-29 Thread Sven Meier
Hi, instead of worrying about exceptions in your #onSubmit() and always wrapping your code in catch-try, you can just use a general exception handler:     getRequestCycleListeners().add(new IRequestCycleListener()         {             @Override             public IRequestHandler

Re: pass error in submit method

2021-06-29 Thread Maxim Solodovnik
Maybe it would be better to perform checks during validation ? from mobile (sorry for typos ;) On Tue, Jun 29, 2021, 22:33 vahid ghasemi wrote: > Hello > How can I pass an error in an onSubmit method? > I have some errors that can detect in the onSubmit method. > I throw exceptions at end of

Re: pass error in submit method

2021-06-29 Thread Sven Meier
Hi, you could use a FormValidator. Or let your onSubmit() (or any code it forwards to) throw exceptions and register an IRequestCycleListener#onException() to handle exceptions during form submit. Have fun Sven On 29.06.21 17:51, vahid ghasemi wrote: I want to add form data to the

pass error in submit method

2021-06-29 Thread vahid ghasemi
Hello How can I pass an error in an onSubmit method? I have some errors that can detect in the onSubmit method. I throw exceptions at end of the onSubmit method. In the catch block, I call the error method, but after that, I expect to don't go into the afterOnSubmit method, but he will go and I am

Re: pass error in submit method

2021-06-29 Thread vahid ghasemi
thanks again for answering my questions. can you send me some examples of this concept? (IRequestCycleListener#onException()) just I want to know more about that. On Tue, Jun 29, 2021 at 8:32 PM Sven Meier wrote: > Hi, > > you could use a FormValidator. > > Or let your onSubmit() (or any code

Re: pass error in submit method

2021-06-29 Thread vahid ghasemi
I want to add form data to the database. so it's not good to loading data for every input and checks from the database. I am using validation and when everything is ok then I connect to the database for better performance :). one Idea is to call the onError method into the onSubmit method. but I

reset form

2021-06-29 Thread vahid ghasemi
Hello guys. I have a form that has two buttons (Submit, Reset) and my form is CompoundPropertiesModel. The type of these buttons are AjaxButtons. but Reset only works when the form is valid, otherwise it goes into the onError method. The type of reset button tag is "reset" and also the submit

Re: reset form

2021-06-29 Thread Maxim Solodovnik
you have to add the fields to the target On Tue, 29 Jun 2021 at 15:22, vahid ghasemi wrote: > First, thanks for the speed of your support. > >1 AjaxButton reset = new AjaxButton("reset") { > >2 @Override > >3public void onSubmit(AjaxRequestTarget target) { > >

Re: reset form

2021-06-29 Thread Bas Gooren
Hi, To remove any user input in form fields, you also need to call Form#clearInput() (or FormComponent#clearInput() to clear specific components). Without this call, the fields will retain the user input instead of showing the empty string you set (assuming that the fields you set to an empty

Re: reset form

2021-06-29 Thread Sven Meier
Hi, you have to call #setDefaultFormProcessing(false). Have fun Sven On 29.06.21 09:46, vahid ghasemi wrote: Hello guys. I have a form that has two buttons (Submit, Reset) and my form is CompoundPropertiesModel. The type of these buttons are AjaxButtons. but Reset only works when the form is

Re: reset form

2021-06-29 Thread vahid ghasemi
First, thanks for the speed of your support. 1 AjaxButton reset = new AjaxButton("reset") { 2 @Override 3public void onSubmit(AjaxRequestTarget target) { 4 name = nationalCode = email = phone = password = confirmPassword = ""; 5