Re: Validate form on page start
Hi, On Sun, Nov 13, 2011 at 2:20 PM, Илья Нарыжный phan...@ydn.ru wrote: Hello, I have following case: There is RegistrationPage in the project. This page fill attributes of new User and persists in the database. But for registration from social networks we want to implement following: show to new user the same RegistrationPage with filled fields according to data recieved from social networks and highlighted errors (for example if EMAIL was not filled). So, is it possible to redirect user to some page with already validated form? Extend org.apache.wicket.markup.html.form.Form and add #myvalidate() that just calls org.apache.wicket.markup.html.form.Form.validate() (it is protected final). Instantiate that page and populate the form components' models (or populate page's pageparameters) and at the end call myForm.myvalidate(). Thanks, Ilia -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Validate form on page start
Hello, Martin, I tried, as you propose, but that doesn't work: page is not initilized, so all validators just validate empty fields without propagated values to it. Maybe I should done that in some onXXX method? (in onBeforeRender and onComponentTag - it doesn't work) Thanks, Ilia Hi, On Sun, Nov 13, 2011 at 2:20 PM, Илья Нарыжный phan...@ydn.ru wrote: Hello, I have following case: There is RegistrationPage in the project. This page fill attributes of new User and persists in the database. But for registration from social networks we want to implement following: show to new user the same RegistrationPage with filled fields according to data recieved from social networks and highlighted errors (for example if EMAIL was not filled). So, is it possible to redirect user to some page with already validated form? Extend org.apache.wicket.markup.html.form.Form and add #myvalidate() that just calls org.apache.wicket.markup.html.form.Form.validate() (it is protected final). Instantiate that page and populate the form components' models (or populate page's pageparameters) and at the end call myForm.myvalidate(). Thanks, Ilia -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Validate form on page start
Hi Ilia, You are correct. May be there is no need of #myvalidate() at all. Just call form#process(null); 2011/11/14 Илья Нарыжный phan...@ydn.ru: Hello, Martin, I tried, as you propose, but that doesn't work: page is not initilized, so all validators just validate empty fields without propagated values to it. Maybe I should done that in some onXXX method? (in onBeforeRender and onComponentTag - it doesn't work) Thanks, Ilia Hi, On Sun, Nov 13, 2011 at 2:20 PM, Илья Нарыжный phan...@ydn.ru wrote: Hello, I have following case: There is RegistrationPage in the project. This page fill attributes of new User and persists in the database. But for registration from social networks we want to implement following: show to new user the same RegistrationPage with filled fields according to data recieved from social networks and highlighted errors (for example if EMAIL was not filled). So, is it possible to redirect user to some page with already validated form? Extend org.apache.wicket.markup.html.form.Form and add #myvalidate() that just calls org.apache.wicket.markup.html.form.Form.validate() (it is protected final). Instantiate that page and populate the form components' models (or populate page's pageparameters) and at the end call myForm.myvalidate(). Thanks, Ilia -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Validate form on page start
Hi, Unfortunatly, it doesn't work too. Process doesn't propogate parameters from Models to FormComponents, so validation just validate empty fields... Ilia 2011/11/14 Martin Grigorov mgrigo...@apache.org Hi Ilia, You are correct. May be there is no need of #myvalidate() at all. Just call form#process(null); 2011/11/14 Илья Нарыжный phan...@ydn.ru: Hello, Martin, I tried, as you propose, but that doesn't work: page is not initilized, so all validators just validate empty fields without propagated values to it. Maybe I should done that in some onXXX method? (in onBeforeRender and onComponentTag - it doesn't work) Thanks, Ilia Hi, On Sun, Nov 13, 2011 at 2:20 PM, Илья Нарыжный phan...@ydn.ru wrote: Hello, I have following case: There is RegistrationPage in the project. This page fill attributes of new User and persists in the database. But for registration from social networks we want to implement following: show to new user the same RegistrationPage with filled fields according to data recieved from social networks and highlighted errors (for example if EMAIL was not filled). So, is it possible to redirect user to some page with already validated form? Extend org.apache.wicket.markup.html.form.Form and add #myvalidate() that just calls org.apache.wicket.markup.html.form.Form.validate() (it is protected final). Instantiate that page and populate the form components' models (or populate page's pageparameters) and at the end call myForm.myvalidate(). Thanks, Ilia -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Validate form on page start
Hi, You need to call org.apache.wicket.markup.html.form.FormComponent.inputChanged() before that. See org.apache.wicket.markup.html.form.FormComponent.inputChanged() 2011/11/14 Илья Нарыжный phan...@ydn.ru: Hi, Unfortunatly, it doesn't work too. Process doesn't propogate parameters from Models to FormComponents, so validation just validate empty fields... Ilia 2011/11/14 Martin Grigorov mgrigo...@apache.org Hi Ilia, You are correct. May be there is no need of #myvalidate() at all. Just call form#process(null); 2011/11/14 Илья Нарыжный phan...@ydn.ru: Hello, Martin, I tried, as you propose, but that doesn't work: page is not initilized, so all validators just validate empty fields without propagated values to it. Maybe I should done that in some onXXX method? (in onBeforeRender and onComponentTag - it doesn't work) Thanks, Ilia Hi, On Sun, Nov 13, 2011 at 2:20 PM, Илья Нарыжный phan...@ydn.ru wrote: Hello, I have following case: There is RegistrationPage in the project. This page fill attributes of new User and persists in the database. But for registration from social networks we want to implement following: show to new user the same RegistrationPage with filled fields according to data recieved from social networks and highlighted errors (for example if EMAIL was not filled). So, is it possible to redirect user to some page with already validated form? Extend org.apache.wicket.markup.html.form.Form and add #myvalidate() that just calls org.apache.wicket.markup.html.form.Form.validate() (it is protected final). Instantiate that page and populate the form components' models (or populate page's pageparameters) and at the end call myForm.myvalidate(). Thanks, Ilia -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Validate form on page start
Martin, Yes. That seems to work, but for case when parameters for page were propogated by PageParameters. But what should I call in case, when value for fields initially should be populated from CompoundPropertyModel and corresponding backend object? Thanks, Ilia 2011/11/14 Martin Grigorov mgrigo...@apache.org Hi, You need to call org.apache.wicket.markup.html.form.FormComponent.inputChanged() before that. See org.apache.wicket.markup.html.form.FormComponent.inputChanged() 2011/11/14 Илья Нарыжный phan...@ydn.ru: Hi, Unfortunatly, it doesn't work too. Process doesn't propogate parameters from Models to FormComponents, so validation just validate empty fields... Ilia 2011/11/14 Martin Grigorov mgrigo...@apache.org Hi Ilia, You are correct. May be there is no need of #myvalidate() at all. Just call form#process(null); 2011/11/14 Илья Нарыжный phan...@ydn.ru: Hello, Martin, I tried, as you propose, but that doesn't work: page is not initilized, so all validators just validate empty fields without propagated values to it. Maybe I should done that in some onXXX method? (in onBeforeRender and onComponentTag - it doesn't work) Thanks, Ilia Hi, On Sun, Nov 13, 2011 at 2:20 PM, Илья Нарыжный phan...@ydn.ru wrote: Hello, I have following case: There is RegistrationPage in the project. This page fill attributes of new User and persists in the database. But for registration from social networks we want to implement following: show to new user the same RegistrationPage with filled fields according to data recieved from social networks and highlighted errors (for example if EMAIL was not filled). So, is it possible to redirect user to some page with already validated form? Extend org.apache.wicket.markup.html.form.Form and add #myvalidate() that just calls org.apache.wicket.markup.html.form.Form.validate() (it is protected final). Instantiate that page and populate the form components' models (or populate page's pageparameters) and at the end call myForm.myvalidate(). Thanks, Ilia -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Validate form on page start
You just need to pass a populated model to the form (components). If FormComponent's input is equal to NO_RAW_INPUT then the model is used. 2011/11/14 Илья Нарыжный phan...@ydn.ru: Martin, Yes. That seems to work, but for case when parameters for page were propogated by PageParameters. But what should I call in case, when value for fields initially should be populated from CompoundPropertyModel and corresponding backend object? Thanks, Ilia 2011/11/14 Martin Grigorov mgrigo...@apache.org Hi, You need to call org.apache.wicket.markup.html.form.FormComponent.inputChanged() before that. See org.apache.wicket.markup.html.form.FormComponent.inputChanged() 2011/11/14 Илья Нарыжный phan...@ydn.ru: Hi, Unfortunatly, it doesn't work too. Process doesn't propogate parameters from Models to FormComponents, so validation just validate empty fields... Ilia 2011/11/14 Martin Grigorov mgrigo...@apache.org Hi Ilia, You are correct. May be there is no need of #myvalidate() at all. Just call form#process(null); 2011/11/14 Илья Нарыжный phan...@ydn.ru: Hello, Martin, I tried, as you propose, but that doesn't work: page is not initilized, so all validators just validate empty fields without propagated values to it. Maybe I should done that in some onXXX method? (in onBeforeRender and onComponentTag - it doesn't work) Thanks, Ilia Hi, On Sun, Nov 13, 2011 at 2:20 PM, Илья Нарыжный phan...@ydn.ru wrote: Hello, I have following case: There is RegistrationPage in the project. This page fill attributes of new User and persists in the database. But for registration from social networks we want to implement following: show to new user the same RegistrationPage with filled fields according to data recieved from social networks and highlighted errors (for example if EMAIL was not filled). So, is it possible to redirect user to some page with already validated form? Extend org.apache.wicket.markup.html.form.Form and add #myvalidate() that just calls org.apache.wicket.markup.html.form.Form.validate() (it is protected final). Instantiate that page and populate the form components' models (or populate page's pageparameters) and at the end call myForm.myvalidate(). Thanks, Ilia -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - 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 - 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Validate form on page start
Martin, It doesn't work... The main reason of that in following: validation of required field is following: public boolean checkRequired() { if (isRequired()) { final String input = getInput(); and getInput method operates only with RequestParameters. So, I don't see eny way to do that in proper way. Some deep changes in Wicket is required to support that case:( Ilia 2011/11/14 Martin Grigorov mgrigo...@apache.org You just need to pass a populated model to the form (components). If FormComponent's input is equal to NO_RAW_INPUT then the model is used. 2011/11/14 Илья Нарыжный phan...@ydn.ru: Martin, Yes. That seems to work, but for case when parameters for page were propogated by PageParameters. But what should I call in case, when value for fields initially should be populated from CompoundPropertyModel and corresponding backend object? Thanks, Ilia 2011/11/14 Martin Grigorov mgrigo...@apache.org Hi, You need to call org.apache.wicket.markup.html.form.FormComponent.inputChanged() before that. See org.apache.wicket.markup.html.form.FormComponent.inputChanged() 2011/11/14 Илья Нарыжный phan...@ydn.ru: Hi, Unfortunatly, it doesn't work too. Process doesn't propogate parameters from Models to FormComponents, so validation just validate empty fields... Ilia 2011/11/14 Martin Grigorov mgrigo...@apache.org Hi Ilia, You are correct. May be there is no need of #myvalidate() at all. Just call form#process(null); 2011/11/14 Илья Нарыжный phan...@ydn.ru: Hello, Martin, I tried, as you propose, but that doesn't work: page is not initilized, so all validators just validate empty fields without propagated values to it. Maybe I should done that in some onXXX method? (in onBeforeRender and onComponentTag - it doesn't work) Thanks, Ilia Hi, On Sun, Nov 13, 2011 at 2:20 PM, Илья Нарыжный phan...@ydn.ru wrote: Hello, I have following case: There is RegistrationPage in the project. This page fill attributes of new User and persists in the database. But for registration from social networks we want to implement following: show to new user the same RegistrationPage with filled fields according to data recieved from social networks and highlighted errors (for example if EMAIL was not filled). So, is it possible to redirect user to some page with already validated form? Extend org.apache.wicket.markup.html.form.Form and add #myvalidate() that just calls org.apache.wicket.markup.html.form.Form.validate() (it is protected final). Instantiate that page and populate the form components' models (or populate page's pageparameters) and at the end call myForm.myvalidate(). Thanks, Ilia -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - 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 - 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Validate form on page start
Ilia, Just an idea... What about triggering validation via AJAX? Form is submmited via AJAX when page is loaded... and you get your form validated. Regards, Ernesto 2011/11/14 Илья Нарыжный phan...@ydn.ru: Martin, It doesn't work... The main reason of that in following: validation of required field is following: public boolean checkRequired() { if (isRequired()) { final String input = getInput(); and getInput method operates only with RequestParameters. So, I don't see eny way to do that in proper way. Some deep changes in Wicket is required to support that case:( Ilia 2011/11/14 Martin Grigorov mgrigo...@apache.org You just need to pass a populated model to the form (components). If FormComponent's input is equal to NO_RAW_INPUT then the model is used. 2011/11/14 Илья Нарыжный phan...@ydn.ru: Martin, Yes. That seems to work, but for case when parameters for page were propogated by PageParameters. But what should I call in case, when value for fields initially should be populated from CompoundPropertyModel and corresponding backend object? Thanks, Ilia 2011/11/14 Martin Grigorov mgrigo...@apache.org Hi, You need to call org.apache.wicket.markup.html.form.FormComponent.inputChanged() before that. See org.apache.wicket.markup.html.form.FormComponent.inputChanged() 2011/11/14 Илья Нарыжный phan...@ydn.ru: Hi, Unfortunatly, it doesn't work too. Process doesn't propogate parameters from Models to FormComponents, so validation just validate empty fields... Ilia 2011/11/14 Martin Grigorov mgrigo...@apache.org Hi Ilia, You are correct. May be there is no need of #myvalidate() at all. Just call form#process(null); 2011/11/14 Илья Нарыжный phan...@ydn.ru: Hello, Martin, I tried, as you propose, but that doesn't work: page is not initilized, so all validators just validate empty fields without propagated values to it. Maybe I should done that in some onXXX method? (in onBeforeRender and onComponentTag - it doesn't work) Thanks, Ilia Hi, On Sun, Nov 13, 2011 at 2:20 PM, Илья Нарыжный phan...@ydn.ru wrote: Hello, I have following case: There is RegistrationPage in the project. This page fill attributes of new User and persists in the database. But for registration from social networks we want to implement following: show to new user the same RegistrationPage with filled fields according to data recieved from social networks and highlighted errors (for example if EMAIL was not filled). So, is it possible to redirect user to some page with already validated form? Extend org.apache.wicket.markup.html.form.Form and add #myvalidate() that just calls org.apache.wicket.markup.html.form.Form.validate() (it is protected final). Instantiate that page and populate the form components' models (or populate page's pageparameters) and at the end call myForm.myvalidate(). Thanks, Ilia -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - 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 - 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org