Re: Submit form before handle onclick
Hi, Use org.apache.wicket.ajax.form.AjaxFormSubmitBehavior#onAfterSubmit if you want to execute something *after* Form#onSubmit() On Sun, Feb 17, 2013 at 8:15 PM, Gonzalo Aguilar Delgado gagui...@aguilardelgado.com wrote: Hello Sven, Yes. I added this to the form, and a eventhandler to the button, but the event handler of the button is always called before the submit. The problem is that I cannot process the onclick handler of the button without the information of the form. So I think I need to submit it on the onclick handler, but how? Thank you in advance. El vie, 15-02-2013 a las 11:07 +0100, Sven Meier escribió:S venO n 02/15/2013 11:01 AM, Gonzalo Aguilar Delgado wrote: Hello, We have just a situation were the information of the form needs to be updated before handling an ajax click event. The page has a form, with a bean and some TextFields that update the properties in the bean. It has also an ajax component that also updates the bean. The problem is that we can fill in the form but if we do an event on the ajax component every field filled in first step is lost because is not submitted (and the bean updated) before handling the ajax click event. So the question is: How can we submit the form before handling the click event? Any suggestion? Thank you in advance. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Submit form before handle onclick
Hi Martin, Ok. I will take a look to this but I think it's not the right solution. Suppose this: - PAGE Example| --- A - This is a form. | B - This is a form.| ---| Supppose that you want to process form B with Ajax but you also need the information the user typed on A. How can you do it? With ajax of course? I will submit A so the model of A gets updated, and after I will submit B. So B has the model of A and B loaded. Is there a better way to do it? El lun, 18-02-2013 a las 10:10 +0200, Martin Grigorov escribió: Use org.apache.wicket.ajax.form.AjaxFormSubmitBehavior#onAfterSubmit if you want to execute something *after* Form#onSubmit()
Re: Submit form before handle onclick
Hi, I think this is not possible if you use two root forms. You need to submit them by order (first A and then B) to have the values. You can use nested forms though. B should be inside A. This way when you submit B Wicket will post all the data (for both A and B) but will process only form B. The values of the form components of A will be available thru request.getPostRequestParameters().get(someFromA) On Mon, Feb 18, 2013 at 10:56 AM, Gonzalo Aguilar Delgado gagui...@aguilardelgado.com wrote: Hi Martin, Ok. I will take a look to this but I think it's not the right solution. Suppose this: - PAGE Example| --- A - This is a form. | B - This is a form.| ---| Supppose that you want to process form B with Ajax but you also need the information the user typed on A. How can you do it? With ajax of course? I will submit A so the model of A gets updated, and after I will submit B. So B has the model of A and B loaded. Is there a better way to do it? El lun, 18-02-2013 a las 10:10 +0200, Martin Grigorov escribió: Use org.apache.wicket.ajax.form.AjaxFormSubmitBehavior#onAfterSubmit if you want to execute something *after* Form#onSubmit() -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Submit form before handle onclick
Hi Martin, Thank you for your answer. What about doing like google and others? I mean save (submit) on lost focus... So the model will get updated every time you leave a field. Any good references? thank you. El lun, 18-02-2013 a las 11:02 +0200, Martin Grigorov escribió: Hi, I think this is not possible if you use two root forms. You need to submit them by order (first A and then B) to have the values. You can use nested forms though. B should be inside A. This way when you submit B Wicket will post all the data (for both A and B) but will process only form B. The values of the form components of A will be available thru request.getPostRequestParameters().get(someFromA) On Mon, Feb 18, 2013 at 10:56 AM, Gonzalo Aguilar Delgado gagui...@aguilardelgado.com wrote: Hi Martin, Ok. I will take a look to this but I think it's not the right solution. Suppose this: - PAGE Example| --- A - This is a form. | B - This is a form.| ---| Supppose that you want to process form B with Ajax but you also need the information the user typed on A. How can you do it? With ajax of course? I will submit A so the model of A gets updated, and after I will submit B. So B has the model of A and B loaded. Is there a better way to do it? El lun, 18-02-2013 a las 10:10 +0200, Martin Grigorov escribió: Use org.apache.wicket.ajax.form.AjaxFormSubmitBehavior#onAfterSubmit if you want to execute something *after* Form#onSubmit()
Re: Submit form before handle onclick
Hi, On Mon, Feb 18, 2013 at 11:45 AM, Gonzalo Aguilar Delgado gagui...@aguilardelgado.com wrote: Hi Martin, Thank you for your answer. What about doing like google and others? I mean save (submit) on lost focus... So the model will get updated every time you leave a field. Isn't this a matter of just attaching an AjaxFormComponentUpdatingBehavior to on blur event? Any good references? thank you. El lun, 18-02-2013 a las 11:02 +0200, Martin Grigorov escribió: Hi, I think this is not possible if you use two root forms. You need to submit them by order (first A and then B) to have the values. You can use nested forms though. B should be inside A. This way when you submit B Wicket will post all the data (for both A and B) but will process only form B. The values of the form components of A will be available thru request.getPostRequestParameters().get(someFromA) On Mon, Feb 18, 2013 at 10:56 AM, Gonzalo Aguilar Delgado gagui...@aguilardelgado.com wrote: Hi Martin, Ok. I will take a look to this but I think it's not the right solution. Suppose this: - PAGE Example| --- A - This is a form. | B - This is a form.| ---| Supppose that you want to process form B with Ajax but you also need the information the user typed on A. How can you do it? With ajax of course? I will submit A so the model of A gets updated, and after I will submit B. So B has the model of A and B loaded. Is there a better way to do it? El lun, 18-02-2013 a las 10:10 +0200, Martin Grigorov escribió: Use org.apache.wicket.ajax.form.AjaxFormSubmitBehavior#onAfterSubmit if you want to execute something *after* Form#onSubmit() -- Regards - Ernesto Reinaldo Barreiro Antilia Soft http://antiliasoft.com/ http://antiliasoft.com/antilia
Re: Submit form before handle onclick
I thought you don't want form A to be submitted and its model updated. Otherwise why you have two forms ? Otherwise use what Ernesto suggested - AjaxFormComponentUpdatingBehavior for each 'required' component of form A. On Mon, Feb 18, 2013 at 12:50 PM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Hi, On Mon, Feb 18, 2013 at 11:45 AM, Gonzalo Aguilar Delgado gagui...@aguilardelgado.com wrote: Hi Martin, Thank you for your answer. What about doing like google and others? I mean save (submit) on lost focus... So the model will get updated every time you leave a field. Isn't this a matter of just attaching an AjaxFormComponentUpdatingBehavior to on blur event? Any good references? thank you. El lun, 18-02-2013 a las 11:02 +0200, Martin Grigorov escribió: Hi, I think this is not possible if you use two root forms. You need to submit them by order (first A and then B) to have the values. You can use nested forms though. B should be inside A. This way when you submit B Wicket will post all the data (for both A and B) but will process only form B. The values of the form components of A will be available thru request.getPostRequestParameters().get(someFromA) On Mon, Feb 18, 2013 at 10:56 AM, Gonzalo Aguilar Delgado gagui...@aguilardelgado.com wrote: Hi Martin, Ok. I will take a look to this but I think it's not the right solution. Suppose this: - PAGE Example| --- A - This is a form. | B - This is a form.| ---| Supppose that you want to process form B with Ajax but you also need the information the user typed on A. How can you do it? With ajax of course? I will submit A so the model of A gets updated, and after I will submit B. So B has the model of A and B loaded. Is there a better way to do it? El lun, 18-02-2013 a las 10:10 +0200, Martin Grigorov escribió: Use org.apache.wicket.ajax.form.AjaxFormSubmitBehavior#onAfterSubmit if you want to execute something *after* Form#onSubmit() -- Regards - Ernesto Reinaldo Barreiro Antilia Soft http://antiliasoft.com/ http://antiliasoft.com/antilia -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Submit form before handle onclick
Hello Sven, Yes. I added this to the form, and a eventhandler to the button, but the event handler of the button is always called before the submit. The problem is that I cannot process the onclick handler of the button without the information of the form. So I think I need to submit it on the onclick handler, but how? Thank you in advance. El vie, 15-02-2013 a las 11:07 +0100, Sven Meier escribió:S venO n 02/15/2013 11:01 AM, Gonzalo Aguilar Delgado wrote: Hello, We have just a situation were the information of the form needs to be updated before handling an ajax click event. The page has a form, with a bean and some TextFields that update the properties in the bean. It has also an ajax component that also updates the bean. The problem is that we can fill in the form but if we do an event on the ajax component every field filled in first step is lost because is not submitted (and the bean updated) before handling the ajax click event. So the question is: How can we submit the form before handling the click event? Any suggestion? Thank you in advance. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Submit form before handle onclick
Hello, We have just a situation were the information of the form needs to be updated before handling an ajax click event. The page has a form, with a bean and some TextFields that update the properties in the bean. It has also an ajax component that also updates the bean. The problem is that we can fill in the form but if we do an event on the ajax component every field filled in first step is lost because is not submitted (and the bean updated) before handling the ajax click event. So the question is: How can we submit the form before handling the click event? Any suggestion? Thank you in advance.
Re: Submit form before handle onclick
Use AjaxFormSubmitBehavior with #setDefaultProcessing(false). Sven On 02/15/2013 11:01 AM, Gonzalo Aguilar Delgado wrote: Hello, We have just a situation were the information of the form needs to be updated before handling an ajax click event. The page has a form, with a bean and some TextFields that update the properties in the bean. It has also an ajax component that also updates the bean. The problem is that we can fill in the form but if we do an event on the ajax component every field filled in first step is lost because is not submitted (and the bean updated) before handling the ajax click event. So the question is: How can we submit the form before handling the click event? Any suggestion? Thank you in advance. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org