Re: wicket-bean-validation 10.0.0-M1-SNAPSHOT not available?
Thank you Martin, the situation is indeed fine. Actually, I was trying to find the artifacts via the web UI of https://repository.apache.org but couldn't make it. I was also under the wrong assumption that the Apache SNAPSHOT repo was already defined in the project: your answer forced me to carry on the appropriate checks and fix. Regards. On 2023/01/03 08:39:36 Martin Grigorov wrote: > https://repository.apache.org/service/local/repo_groups/snapshots-group/content/org/apache/wicket/wicket-devutils/10.0.0-M1-SNAPSHOT/wicket-devutils-10.0.0-M1-20221118.110647-169.pom > https://repository.apache.org/service/local/repo_groups/snapshots-group/content/org/apache/wicket/wicket-bean-validation/10.0.0-M1-SNAPSHOT/wicket-bean-validation-10.0.0-M1-20221118.110647-167.pom > > Both seem to be there. > > > On Tue, Jan 3, 2023 at 9:35 AM Francesco Chicchiriccò > wrote: > > > Forgot to add that the same happens with wicket-devutils. > > > > Regards. > > > > On 2023/01/03 07:33:36 Francesco Chicchiriccò wrote: > > > Hi there, > > > I am working to upgrade our Wicket apps to Spring Boot 3 and found that > > 10.0.0-M1-SNAPSHOT plays nicely with it. > > > > > > It seems however, that > > > > > > org.apache.wicket:wicket-bean-validation:10.0.0-M1-SNAPSHOT > > > > > > is not available from > > > > > > https://repository.apache.org/ > > > > > > while the module seems to be regularly present in the source tree at > > > > > > https://github.com/apache/wicket/tree/master/wicket-bean-validation > > > > > > Maybe something bad with CI deployment? > > > > > > Regards. > > > > > > -- > > > Francesco Chicchiriccò > > > > > > Tirasa - Open Source Excellence > > > http://www.tirasa.net/ > > > > > > Member at The Apache Software Foundation > > > Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail > > > http://home.apache.org/~ilgrosso/ > > > > > > > > > - > > > 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 > > > > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket-bean-validation 10.0.0-M1-SNAPSHOT not available?
https://repository.apache.org/service/local/repo_groups/snapshots-group/content/org/apache/wicket/wicket-devutils/10.0.0-M1-SNAPSHOT/wicket-devutils-10.0.0-M1-20221118.110647-169.pom https://repository.apache.org/service/local/repo_groups/snapshots-group/content/org/apache/wicket/wicket-bean-validation/10.0.0-M1-SNAPSHOT/wicket-bean-validation-10.0.0-M1-20221118.110647-167.pom Both seem to be there. On Tue, Jan 3, 2023 at 9:35 AM Francesco Chicchiriccò wrote: > Forgot to add that the same happens with wicket-devutils. > > Regards. > > On 2023/01/03 07:33:36 Francesco Chicchiriccò wrote: > > Hi there, > > I am working to upgrade our Wicket apps to Spring Boot 3 and found that > 10.0.0-M1-SNAPSHOT plays nicely with it. > > > > It seems however, that > > > > org.apache.wicket:wicket-bean-validation:10.0.0-M1-SNAPSHOT > > > > is not available from > > > > https://repository.apache.org/ > > > > while the module seems to be regularly present in the source tree at > > > > https://github.com/apache/wicket/tree/master/wicket-bean-validation > > > > Maybe something bad with CI deployment? > > > > Regards. > > > > -- > > Francesco Chicchiriccò > > > > Tirasa - Open Source Excellence > > http://www.tirasa.net/ > > > > Member at The Apache Software Foundation > > Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail > > http://home.apache.org/~ilgrosso/ > > > > > > - > > 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 > >
Re: wicket-bean-validation 10.0.0-M1-SNAPSHOT not available?
Forgot to add that the same happens with wicket-devutils. Regards. On 2023/01/03 07:33:36 Francesco Chicchiriccò wrote: > Hi there, > I am working to upgrade our Wicket apps to Spring Boot 3 and found that > 10.0.0-M1-SNAPSHOT plays nicely with it. > > It seems however, that > > org.apache.wicket:wicket-bean-validation:10.0.0-M1-SNAPSHOT > > is not available from > > https://repository.apache.org/ > > while the module seems to be regularly present in the source tree at > > https://github.com/apache/wicket/tree/master/wicket-bean-validation > > Maybe something bad with CI deployment? > > Regards. > > -- > Francesco Chicchiriccò > > Tirasa - Open Source Excellence > http://www.tirasa.net/ > > Member at The Apache Software Foundation > Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail > http://home.apache.org/~ilgrosso/ > > > - > 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
wicket-bean-validation 10.0.0-M1-SNAPSHOT not available?
Hi there, I am working to upgrade our Wicket apps to Spring Boot 3 and found that 10.0.0-M1-SNAPSHOT plays nicely with it. It seems however, that org.apache.wicket:wicket-bean-validation:10.0.0-M1-SNAPSHOT is not available from https://repository.apache.org/ while the module seems to be regularly present in the source tree at https://github.com/apache/wicket/tree/master/wicket-bean-validation Maybe something bad with CI deployment? Regards. -- Francesco Chicchiriccò Tirasa - Open Source Excellence http://www.tirasa.net/ Member at The Apache Software Foundation Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail http://home.apache.org/~ilgrosso/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Validation message parameters and internationalization
or use Java 8 goodies ;-) setLabel(() -> getString("label_key")); On Mon, Jan 28, 2019 at 1:29 PM Maxim Solodovnik wrote: > Yes, > > ResourceModel seems to be much better to use in this case > Not the best example :( > > On Mon, 28 Jan 2019 at 18:24, Ernesto Reinaldo Barreiro < > reier...@gmail.com> > wrote: > > > Hi, > > > > On Mon, Jan 28, 2019 at 1:04 PM Maxim Solodovnik > > wrote: > > > > > Hello Zbynek, > > > > > > In our project we are customizing validation messages as follows: > > > > > > Markup: > > > > > > > > > > > > Java: > > > add(new > > > > > > > > > RequiredTextField("wicketid").setLabel(Model.of(getString("label_key"; > > > > > > > But this will make serialized pages bigger, if key values are bigger > > compared to keys, as deach on resource model will keep key and discard > > value (if I'm not mistaken). > > > > > > > > > > This way lots of built-in validation messages will be "auto-customized" > > > > > > not sure if it will work for you > > > > > > > > > On Mon, 28 Jan 2019 at 16:44, Zbynek Vavros > > > wrote: > > > > > > > So I am using localized version of validation message for required > > fields > > > > > > > > Required=My custom message for field '${label}' > > > > > > > > but the resulting message contains field ID as parameters and result > is > > > > i.e. > > > > > > > > "My custom message for field 'password'" > > > > > > > > since the whole page is not in English I would like to have the > > parameter > > > > localized as well. > > > > Some of the users do not speak English and they would not understand > > what > > > > "password" is. > > > > > > > > I see in code of org.apache.wicket.markup.html.form.FormComponent > > > > that the component's getId() is used as parameter. Any way to > customize > > > > this? > > > > > > > > I can surely use validation message for this specific field with key > > i.e. > > > > "password.Required" > > > > but I would like to be more generic. > > > > > > > > Thanks, > > > > Zbynek > > > > > > > > > > > > > -- > > > WBR > > > Maxim aka solomax > > > > > > > > > -- > > Regards - Ernesto Reinaldo Barreiro > > > > > -- > WBR > Maxim aka solomax >
Re: Validation message parameters and internationalization
Yes, ResourceModel seems to be much better to use in this case Not the best example :( On Mon, 28 Jan 2019 at 18:24, Ernesto Reinaldo Barreiro wrote: > Hi, > > On Mon, Jan 28, 2019 at 1:04 PM Maxim Solodovnik > wrote: > > > Hello Zbynek, > > > > In our project we are customizing validation messages as follows: > > > > Markup: > > > > > > > > Java: > > add(new > > > > > RequiredTextField("wicketid").setLabel(Model.of(getString("label_key"; > > > > But this will make serialized pages bigger, if key values are bigger > compared to keys, as deach on resource model will keep key and discard > value (if I'm not mistaken). > > > > > > This way lots of built-in validation messages will be "auto-customized" > > > > not sure if it will work for you > > > > > > On Mon, 28 Jan 2019 at 16:44, Zbynek Vavros > > wrote: > > > > > So I am using localized version of validation message for required > fields > > > > > > Required=My custom message for field '${label}' > > > > > > but the resulting message contains field ID as parameters and result is > > > i.e. > > > > > > "My custom message for field 'password'" > > > > > > since the whole page is not in English I would like to have the > parameter > > > localized as well. > > > Some of the users do not speak English and they would not understand > what > > > "password" is. > > > > > > I see in code of org.apache.wicket.markup.html.form.FormComponent > > > that the component's getId() is used as parameter. Any way to customize > > > this? > > > > > > I can surely use validation message for this specific field with key > i.e. > > > "password.Required" > > > but I would like to be more generic. > > > > > > Thanks, > > > Zbynek > > > > > > > > > -- > > WBR > > Maxim aka solomax > > > > > -- > Regards - Ernesto Reinaldo Barreiro > -- WBR Maxim aka solomax
Re: Validation message parameters and internationalization
Hi, On Mon, Jan 28, 2019 at 1:04 PM Maxim Solodovnik wrote: > Hello Zbynek, > > In our project we are customizing validation messages as follows: > > Markup: > > > > Java: > add(new > > RequiredTextField("wicketid").setLabel(Model.of(getString("label_key"; > But this will make serialized pages bigger, if key values are bigger compared to keys, as deach on resource model will keep key and discard value (if I'm not mistaken). > > This way lots of built-in validation messages will be "auto-customized" > > not sure if it will work for you > > > On Mon, 28 Jan 2019 at 16:44, Zbynek Vavros > wrote: > > > So I am using localized version of validation message for required fields > > > > Required=My custom message for field '${label}' > > > > but the resulting message contains field ID as parameters and result is > > i.e. > > > > "My custom message for field 'password'" > > > > since the whole page is not in English I would like to have the parameter > > localized as well. > > Some of the users do not speak English and they would not understand what > > "password" is. > > > > I see in code of org.apache.wicket.markup.html.form.FormComponent > > that the component's getId() is used as parameter. Any way to customize > > this? > > > > I can surely use validation message for this specific field with key i.e. > > "password.Required" > > but I would like to be more generic. > > > > Thanks, > > Zbynek > > > > > -- > WBR > Maxim aka solomax > -- Regards - Ernesto Reinaldo Barreiro
Re: Validation message parameters and internationalization
Hello Zbynek, In our project we are customizing validation messages as follows: Markup: Java: add(new RequiredTextField("wicketid").setLabel(Model.of(getString("label_key"; This way lots of built-in validation messages will be "auto-customized" not sure if it will work for you On Mon, 28 Jan 2019 at 16:44, Zbynek Vavros wrote: > So I am using localized version of validation message for required fields > > Required=My custom message for field '${label}' > > but the resulting message contains field ID as parameters and result is > i.e. > > "My custom message for field 'password'" > > since the whole page is not in English I would like to have the parameter > localized as well. > Some of the users do not speak English and they would not understand what > "password" is. > > I see in code of org.apache.wicket.markup.html.form.FormComponent > that the component's getId() is used as parameter. Any way to customize > this? > > I can surely use validation message for this specific field with key i.e. > "password.Required" > but I would like to be more generic. > > Thanks, > Zbynek > -- WBR Maxim aka solomax
Re: Validation message parameters and internationalization
Hi, You should use FormComponent.setLabel(IModel). The parameter most probably will be ResourceModel. https://github.com/apache/wicket/blob/684c297cc79f169eeced9e124e7a7e5fe81fb774/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java#L1018-L1030 On Mon, Jan 28, 2019 at 11:44 AM Zbynek Vavros wrote: > So I am using localized version of validation message for required fields > > Required=My custom message for field '${label}' > > but the resulting message contains field ID as parameters and result is > i.e. > > "My custom message for field 'password'" > > since the whole page is not in English I would like to have the parameter > localized as well. > Some of the users do not speak English and they would not understand what > "password" is. > > I see in code of org.apache.wicket.markup.html.form.FormComponent > that the component's getId() is used as parameter. Any way to customize > this? > > I can surely use validation message for this specific field with key i.e. > "password.Required" > but I would like to be more generic. > > Thanks, > Zbynek >
Re: Validation message parameters and internationalization
Hi, You need to set the label model on your FormComponent, component id is used as a fallback. See Wicket guide: https://ci.apache.org/projects/wicket/guide/8.x/single.html#_feedback_messages_and_localization Kind regards, Florian Lacreuse Le 28/01/2019 à 10:43, Zbynek Vavros a écrit : So I am using localized version of validation message for required fields Required=My custom message for field '${label}' but the resulting message contains field ID as parameters and result is i.e. "My custom message for field 'password'" since the whole page is not in English I would like to have the parameter localized as well. Some of the users do not speak English and they would not understand what "password" is. I see in code of org.apache.wicket.markup.html.form.FormComponent that the component's getId() is used as parameter. Any way to customize this? I can surely use validation message for this specific field with key i.e. "password.Required" but I would like to be more generic. Thanks, Zbynek -- Kobalt <https://www.kobalt.fr/> Florian Lacreuse Lead developer · Expert Java / UX 06 95 57 48 57 www.kobalt.fr <https://www.kobalt.fr/>
Validation message parameters and internationalization
So I am using localized version of validation message for required fields Required=My custom message for field '${label}' but the resulting message contains field ID as parameters and result is i.e. "My custom message for field 'password'" since the whole page is not in English I would like to have the parameter localized as well. Some of the users do not speak English and they would not understand what "password" is. I see in code of org.apache.wicket.markup.html.form.FormComponent that the component's getId() is used as parameter. Any way to customize this? I can surely use validation message for this specific field with key i.e. "password.Required" but I would like to be more generic. Thanks, Zbynek
Re: customize the validation message for Form setMaxSize()
yes ,i find the key. thanks -- Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: customize the validation message for Form setMaxSize()
Hi, You need to provide your own value for resource key: uploadTooLarge https://github.com/apache/wicket/blob/b21ec2d4b57a1533b92b6c433a728682c90bc9de/wicket-core/src/main/java/org/apache/wicket/Application.properties#L63 On Thu, Oct 4, 2018 at 6:46 AM extraquoo wrote: > Hi , > > i am using setMaxSize() to limit the file upload size. > Looks like the validation message is default to "Upload must be less than > " > Is there any way to customize this validation message ? > > -- > Sent from: > http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
customize the validation message for Form setMaxSize()
Hi , i am using setMaxSize() to limit the file upload size. Looks like the validation message is default to "Upload must be less than " Is there any way to customize this validation message ? -- Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AjaxRequestTarget not updating after validation
Hi, your code didn't make it into the mailing list, but I've checked it on Nabble: I don't see anything wrong and your example should work as you expect it. Check your markup for misplaced open/close tags, maybe something is misinterpreted by Chrome when you update part of the page. Or create a quickstart showing the problem. Have fun Sven Am 02.11.2017 um 21:12 schrieb SeldonCrisis: Hello everyone, I am experiencing some strange behavior in Wicket when attempting to submit a Form through ajax... I have a custom panel (*FileUploadPanel* which extends *Panel*) that I created. It is used to upload files, but it is more robust than a FileUploadField. I have also added a *ComponentFeedbackPanel* to the *WebMarkupContainer* containing FileUploadPanel: Whenever my form is submitted, I have logic that checks to see whether any files have been uploaded to my custom panel. If not, I invoke this code: and add the WebMarkupContainer that holds this custom panel to the AjaxRequestTarget: All of this SHOULD mean that when I submit the form, I see the error message "This Document is Required" right where I placed my ComponentFeedbackPanel in the markup. BUT it seems that this is not the case, and when I look at the HTML in my chrome developer console, I see that the Ajax response is missing the span tag containing my ComponentFeedbackPanel. If I press any other button on my page that invokes a refresh through AjaxRequestTarget (For example, the save button which has defaultFormProcessing set to False), the span tag is included in the HTML through the ajax response. So why is the Ajax response failing to include my fileUploadPanel.error("This document is required"); message on the form submit? It is only picked up if I refresh a second time. Thanks in advance for your help! -- Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html - 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
AjaxRequestTarget not updating after validation
Hello everyone, I am experiencing some strange behavior in Wicket when attempting to submit a Form through ajax... I have a custom panel (*FileUploadPanel* which extends *Panel*) that I created. It is used to upload files, but it is more robust than a FileUploadField. I have also added a *ComponentFeedbackPanel* to the *WebMarkupContainer* containing FileUploadPanel: Whenever my form is submitted, I have logic that checks to see whether any files have been uploaded to my custom panel. If not, I invoke this code: and add the WebMarkupContainer that holds this custom panel to the AjaxRequestTarget: All of this SHOULD mean that when I submit the form, I see the error message "This Document is Required" right where I placed my ComponentFeedbackPanel in the markup. BUT it seems that this is not the case, and when I look at the HTML in my chrome developer console, I see that the Ajax response is missing the span tag containing my ComponentFeedbackPanel. If I press any other button on my page that invokes a refresh through AjaxRequestTarget (For example, the save button which has defaultFormProcessing set to False), the span tag is included in the HTML through the ajax response. So why is the Ajax response failing to include my fileUploadPanel.error("This document is required"); message on the form submit? It is only picked up if I refresh a second time. Thanks in advance for your help! -- Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Validation messages from properties file not working.
That's perfect. Thanks so much. Brian Mulholland "For every complex problem, there is an answer that is clear, simple and wrong." --H.L. Mencken "Politics is the art of looking for trouble, finding it everywhere, diagnosing it incorrectly, and applying the wrong remedies." --Groucho Marx On Wed, Aug 23, 2017 at 3:56 PM, Sven Meier [via Apache Wicket] < ml+s1842946n4678590...@n4.nabble.com> wrote: > Hi, > > FormComponent has a special error() method for ValidationErrors. > > You're hitting another method on Component, that just accepts any > serializable: > > ((WebMarkupContainer) form.get("wmcCaptchaError")).error(new > ValidationError().addKey("CaptchaRequired")); > > Try the following instead: > > ((WebMarkupContainer) > form.get("wmcCaptchaError")).error(form.getString("CaptchaRequired")); > > Regards > Sven > > > Am 23.08.2017 um 19:18 schrieb Entropy: > > > Yeah, it's definitely related to the component that the > > ComponentFeedbackPanel relates to. If I use a TextField, it finds the > > message perfectly. I change it to a web markup container or > hiddenfield, > > and it fails to find the message. Same name, same code doing the > validation > > and the adding of the validation key. > > > > I tried a TextField with visibility set to false and that didn't even > show > > the error (which makes sense). > > > > -- > > View this message in context: http://apache-wicket.1842946. > n4.nabble.com/Validation-messages-from-properties-file- > not-working-tp4678575p4678588.html > > Sent from the Users forum mailing list archive at Nabble.com. > > > > - > > To unsubscribe, e-mail: [hidden email] > <http:///user/SendEmail.jtp?type=node&node=4678590&i=0> > > For additional commands, e-mail: [hidden email] > <http:///user/SendEmail.jtp?type=node&node=4678590&i=1> > > > > > - > To unsubscribe, e-mail: [hidden email] > <http:///user/SendEmail.jtp?type=node&node=4678590&i=2> > For additional commands, e-mail: [hidden email] > <http:///user/SendEmail.jtp?type=node&node=4678590&i=3> > > > > -- > If you reply to this email, your message will be added to the discussion > below: > http://apache-wicket.1842946.n4.nabble.com/Validation- > messages-from-properties-file-not-working-tp4678575p4678590.html > To unsubscribe from Validation messages from properties file not working., > click > here > <http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4678575&code=YmxtdWxob2xsYW5kQGdtYWlsLmNvbXw0Njc4NTc1fC05NzMyODEwMzU=> > . > NAML > <http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Validation-messages-from-properties-file-not-working-tp4678575p4678596.html Sent from the Users forum 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
Re: Validation messages from properties file not working.
Hi, FormComponent has a special error() method for ValidationErrors. You're hitting another method on Component, that just accepts any serializable: ((WebMarkupContainer) form.get("wmcCaptchaError")).error(new ValidationError().addKey("CaptchaRequired")); Try the following instead: ((WebMarkupContainer) form.get("wmcCaptchaError")).error(form.getString("CaptchaRequired")); Regards Sven Am 23.08.2017 um 19:18 schrieb Entropy: Yeah, it's definitely related to the component that the ComponentFeedbackPanel relates to. If I use a TextField, it finds the message perfectly. I change it to a web markup container or hiddenfield, and it fails to find the message. Same name, same code doing the validation and the adding of the validation key. I tried a TextField with visibility set to false and that didn't even show the error (which makes sense). -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Validation-messages-from-properties-file-not-working-tp4678575p4678588.html Sent from the Users forum 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Validation messages from properties file not working.
Yeah, it's definitely related to the component that the ComponentFeedbackPanel relates to. If I use a TextField, it finds the message perfectly. I change it to a web markup container or hiddenfield, and it fails to find the message. Same name, same code doing the validation and the adding of the validation key. I tried a TextField with visibility set to false and that didn't even show the error (which makes sense). -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Validation-messages-from-properties-file-not-working-tp4678575p4678588.html Sent from the Users forum 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
Re: Validation messages from properties file not working.
The properties file is in the same package as the page, and has the same prefix name, LandingPage_Cp10. Other errors added to TextFields and whatnot from the SAME VALIDATOR are working that use messages from that SAME FILE. I even can add the same message to a regular textfield in that same validator and it works fine. There's definitely something about the fact that it's not a normal textfield that messes it up. Brian Mulholland "For every complex problem, there is an answer that is clear, simple and wrong." --H.L. Mencken "Politics is the art of looking for trouble, finding it everywhere, diagnosing it incorrectly, and applying the wrong remedies." --Groucho Marx On Wed, Aug 23, 2017 at 2:54 AM, Martin Grigorov-4 [via Apache Wicket] < ml+s1842946n4678577...@n4.nabble.com> wrote: > Hi, > > We need to know the location of the i18n file, the package structure and > the component tree structure to be able to tell why Wicket cannot find it > ... > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > On Tue, Aug 22, 2017 at 9:33 PM, Entropy <[hidden email] > <http:///user/SendEmail.jtp?type=node&node=4678577&i=0>> wrote: > > > We have a javascript widget on our page that doesn't have a wicket form > > component bound to it. We just get the value from the request. We have > a > > ComponentFeedbackPanel (CFP) because that's what we do with all of our > > messages. We fed a WebMarkupContainer (WMC) that is around the CFP in > as > > the Component for the CFP to relate to. We add the validation message > to > > that WMC, and the error DOES show. > > > > However, for some reason it's not finding the validation key from the > > property file. Every other error done the same way DOES, so i have to > > guess > > that it's because we are binding to the WMC that it's not working? > > > > Properties File line: > > CaptchaRequired=The CAPTCHA verification is required. Please complete it > to > > continue. > > > > Where we add the key (in an abstractformvalidator): > > ((WebMarkupContainer) form.get("wmcCaptchaError")).error(new > > ValidationError().addKey("CaptchaRequired")); > > > > Ideas? > > > > > > > > -- > > View this message in context: http://apache-wicket.1842946. > > n4.nabble.com/Validation-messages-from-properties-file- > > not-working-tp4678575.html > > Sent from the Users forum mailing list archive at Nabble.com. > > > > - > > To unsubscribe, e-mail: [hidden email] > <http:///user/SendEmail.jtp?type=node&node=4678577&i=1> > > For additional commands, e-mail: [hidden email] > <http:///user/SendEmail.jtp?type=node&node=4678577&i=2> > > > > > > > -- > If you reply to this email, your message will be added to the discussion > below: > http://apache-wicket.1842946.n4.nabble.com/Validation- > messages-from-properties-file-not-working-tp4678575p4678577.html > To unsubscribe from Validation messages from properties file not working., > click > here > <http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4678575&code=YmxtdWxob2xsYW5kQGdtYWlsLmNvbXw0Njc4NTc1fC05NzMyODEwMzU=> > . > NAML > <http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Validation-messages-from-properties-file-not-working-tp4678575p4678585.html Sent from the Users forum 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
Re: Validation messages from properties file not working.
Hi, We need to know the location of the i18n file, the package structure and the component tree structure to be able to tell why Wicket cannot find it ... Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Tue, Aug 22, 2017 at 9:33 PM, Entropy wrote: > We have a javascript widget on our page that doesn't have a wicket form > component bound to it. We just get the value from the request. We have a > ComponentFeedbackPanel (CFP) because that's what we do with all of our > messages. We fed a WebMarkupContainer (WMC) that is around the CFP in as > the Component for the CFP to relate to. We add the validation message to > that WMC, and the error DOES show. > > However, for some reason it's not finding the validation key from the > property file. Every other error done the same way DOES, so i have to > guess > that it's because we are binding to the WMC that it's not working? > > Properties File line: > CaptchaRequired=The CAPTCHA verification is required. Please complete it to > continue. > > Where we add the key (in an abstractformvalidator): > ((WebMarkupContainer) form.get("wmcCaptchaError")).error(new > ValidationError().addKey("CaptchaRequired")); > > Ideas? > > > > -- > View this message in context: http://apache-wicket.1842946. > n4.nabble.com/Validation-messages-from-properties-file- > not-working-tp4678575.html > Sent from the Users forum 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 > >
Validation messages from properties file not working.
We have a javascript widget on our page that doesn't have a wicket form component bound to it. We just get the value from the request. We have a ComponentFeedbackPanel (CFP) because that's what we do with all of our messages. We fed a WebMarkupContainer (WMC) that is around the CFP in as the Component for the CFP to relate to. We add the validation message to that WMC, and the error DOES show. However, for some reason it's not finding the validation key from the property file. Every other error done the same way DOES, so i have to guess that it's because we are binding to the WMC that it's not working? Properties File line: CaptchaRequired=The CAPTCHA verification is required. Please complete it to continue. Where we add the key (in an abstractformvalidator): ((WebMarkupContainer) form.get("wmcCaptchaError")).error(new ValidationError().addKey("CaptchaRequired")); Ideas? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Validation-messages-from-properties-file-not-working-tp4678575.html Sent from the Users forum 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
Re: AjaxButton not calling onError after required validation fail
When the world doesn't make sense, it's amazing how often it turns out to be some simple little mistake we overlook. This was all a cut & paste error in my co-worker's code. He was binding the ComponentFeedbackPanels to the wrong text fields, but the names were close enough to the correct names that a casual inspection by every pair of eyes that tried to help him missed the difference. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxButton-not-calling-onError-after-required-validation-fail-tp4678346p4678393.html Sent from the Users forum 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
Re: AjaxButton not calling onError after required validation fail
Set a breakpoint at FeedbackMessage#markRendered() and see when this happens. It seems something marks the feedback message as rendered before it being rendered. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Mon, Jul 31, 2017 at 9:57 PM, Entropy wrote: > Okay, new info. So, alot of what I said I accepted on faith from a > co-worker > who was working the problem. I'm posting on his behalf. Turns out some of > that was wrong, but we do have a little bit of a poser here nonetheless. I > apologize for that. I should make my guys all sign up for this forum > rather > than using me as a go between. > > First, the button.onError(target, form) is invoked. However, the > ComponentFeedbackPanel is not rendering. We have a custom behavior that > writes an error css class onto the control if isValid() is false, and that > is working. In debug, I can see the hasFeedbackMessage()==true, and the > getFeedbackMessages() returns an error with the right field name on it. > Yes > the component feedback does not render. > > I put setOutputMarkupId(true) on literally everything, and > setOutputPlaceholderTag(true) on the component feedbacks. That didn't > help. > I explicitly added each feedback to the target rather than their parent. > > Yet the ComponentFeedbackPanel doesn't show the errors. I looked in F12 > tools and saw that the span for it actually IS there, there's just nothing > in it. > > -- > View this message in context: http://apache-wicket.1842946. > n4.nabble.com/AjaxButton-not-calling-onError-after- > required-validation-fail-tp4678346p4678384.html > Sent from the Users forum 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 > >
Re: AjaxButton not calling onError after required validation fail
Okay, new info. So, alot of what I said I accepted on faith from a co-worker who was working the problem. I'm posting on his behalf. Turns out some of that was wrong, but we do have a little bit of a poser here nonetheless. I apologize for that. I should make my guys all sign up for this forum rather than using me as a go between. First, the button.onError(target, form) is invoked. However, the ComponentFeedbackPanel is not rendering. We have a custom behavior that writes an error css class onto the control if isValid() is false, and that is working. In debug, I can see the hasFeedbackMessage()==true, and the getFeedbackMessages() returns an error with the right field name on it. Yes the component feedback does not render. I put setOutputMarkupId(true) on literally everything, and setOutputPlaceholderTag(true) on the component feedbacks. That didn't help. I explicitly added each feedback to the target rather than their parent. Yet the ComponentFeedbackPanel doesn't show the errors. I looked in F12 tools and saw that the span for it actually IS there, there's just nothing in it. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxButton-not-calling-onError-after-required-validation-fail-tp4678346p4678384.html Sent from the Users forum 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
Re: AjaxButton not calling onError after required validation fail
I guess Wicket thinks that some of the other buttons is clicked instead. Attach the debugger and see what happens. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Mon, Jul 31, 2017 at 3:39 PM, Entropy wrote: > Wicket 6.24 > > Yes, there are other buttons. Somehow, they seem to work under the same > conditions. We compared and don't see why they behave differently. There > are alternate panels that show/hide based on choices further up the form, > and that dictates which buttons and fields are shown. > > Yes, form.onError() seems to be called. But with no ajax target, how can I > add the right feedback panel components to the target? > > -- > View this message in context: http://apache-wicket.1842946. > n4.nabble.com/AjaxButton-not-calling-onError-after- > required-validation-fail-tp4678346p4678362.html > Sent from the Users forum 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 > >
Re: AjaxButton not calling onError after required validation fail
Wicket 6.24 Yes, there are other buttons. Somehow, they seem to work under the same conditions. We compared and don't see why they behave differently. There are alternate panels that show/hide based on choices further up the form, and that dictates which buttons and fields are shown. Yes, form.onError() seems to be called. But with no ajax target, how can I add the right feedback panel components to the target? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxButton-not-calling-onError-after-required-validation-fail-tp4678346p4678362.html Sent from the Users forum 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
Re: AjaxButton not calling onError after required validation fail
Hi, The provided information is not enough to help you. Which version of Wicket do you use ? Do you have other buttons in this form ? Is Form#onError() called ? Put a breakpoint in Form#onFormSubmitted() and follow to see where it goes. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Fri, Jul 28, 2017 at 11:12 PM, Entropy wrote: > We have an AjaxButton, some fields are failing required check, but the > onError of the button is not being invoked. This means we can't add the > container to the target, and therefore the ComponentFeedbackPanel is not > rendering with the message. > > radioWmc2Step1.add(new AjaxButton("btnResSend", form) > { > @Override > protected void onSubmit(AjaxRequestTarget target, > Form form) { > log.debug("btnResSend"); > > logUserAction(ocpAuthorization.getEmailAddress(), > "601", "CP10", "OCP", > "Send PIN"); > onSendPin(); > radioWmc2Step1.setVisible(false); > radioWmc2Step2.setVisible(true); > > target.add(radioWmc2Step1); > target.add(radioWmc2Step2); > } > > @Override > protected void onError(AjaxRequestTarget target, > Form form) { > //does not fire on required message > target.add(radioWmc2Step1); > }; > } > .setOutputMarkupId(true) > .setOutputMarkupPlaceholderTag(true) > ); > > -- > View this message in context: http://apache-wicket.1842946. > n4.nabble.com/AjaxButton-not-calling-onError-after- > required-validation-fail-tp4678346.html > Sent from the Users forum 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 > >
AjaxButton not calling onError after required validation fail
We have an AjaxButton, some fields are failing required check, but the onError of the button is not being invoked. This means we can't add the container to the target, and therefore the ComponentFeedbackPanel is not rendering with the message. radioWmc2Step1.add(new AjaxButton("btnResSend", form) { @Override protected void onSubmit(AjaxRequestTarget target, Form form) { log.debug("btnResSend"); logUserAction(ocpAuthorization.getEmailAddress(), "601", "CP10", "OCP", "Send PIN"); onSendPin(); radioWmc2Step1.setVisible(false); radioWmc2Step2.setVisible(true); target.add(radioWmc2Step1); target.add(radioWmc2Step2); } @Override protected void onError(AjaxRequestTarget target, Form form) { //does not fire on required message target.add(radioWmc2Step1); }; } .setOutputMarkupId(true) .setOutputMarkupPlaceholderTag(true) ); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxButton-not-calling-onError-after-required-validation-fail-tp4678346.html Sent from the Users forum 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
Re: Form validation and model objects not getting updated on failure
Hi, You can do this by adding OnChangeAjaxBehavior("change") to each and every form component. This way they will send their values to the server as soon as they are edited. If the value is valid then it will be stored in the model, if not - only this form component will render its invalid feedback message. There is no way to store some of the form components' model objects when submitting a whole form! But in this case as it has been explained in your previous question here at users@ the form components will use their 'input' state and the user won't need to re-enter the values again. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Wed, Jun 28, 2017 at 2:01 AM, Lon Varscsak wrote: > Hey there, so I have a form with many textfields all of which have > validators on them. In a situation where I’m creating a “new” record, all > the fields are blank. I also have a DropDownChoice object with an > AjaxFormSubmitBehavior (“change”) attached. > > If the user clicks “save” prematurely, obviously there will be a lot of > errors on the form. Also if the first thing they do is choose an option in > the DropDownChoice some of the form values are invalid. The problem that I > have is that it seems like even though some of the values (in this case the > form component bound to the drop down choice) are valid, those values don’t > make it into the model because of the other invalid values. > > Is there a way to circumvent this? I’m okay with fields that have invalid > values not making it into their model objects (makes sense most of the > time), but in this case I want some to not update and some to update. > > Thanks for your time, > > Lon >
Form validation and model objects not getting updated on failure
Hey there, so I have a form with many textfields all of which have validators on them. In a situation where I’m creating a “new” record, all the fields are blank. I also have a DropDownChoice object with an AjaxFormSubmitBehavior (“change”) attached. If the user clicks “save” prematurely, obviously there will be a lot of errors on the form. Also if the first thing they do is choose an option in the DropDownChoice some of the form values are invalid. The problem that I have is that it seems like even though some of the values (in this case the form component bound to the drop down choice) are valid, those values don’t make it into the model because of the other invalid values. Is there a way to circumvent this? I’m okay with fields that have invalid values not making it into their model objects (makes sense most of the time), but in this case I want some to not update and some to update. Thanks for your time, Lon
Re: Modal dialog, form validation in AjaxBootstrapTabbedPanel
Me too :-) On Mon, May 8, 2017 at 12:56 PM, Martin Grigorov wrote: > Hi Ulrich, > > I'm glad to hear that it worked so easily! > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > On Mon, May 8, 2017 at 12:05 PM, Knaack, Ulrich < > ulrich.kna...@lgln.niedersachsen.de> wrote: > > > Hi Martin, > > > > sorry for late replying. Issues in another project prevented me from > > testing your hint. > > > > Using ClientSideBootstrapTabbedPanel solved my problem completely. > > I simply replaced "class MyAjaxTabbedPanel extends > > AjaxBootstrapTabbedPanel" > > with > > "class MyAjaxTabbedPanel extends ClientSideBootstrapTabbedPanel " > > and removed unnecessary methods. > > Then, wicket gave me useful hints related to a ClassCastException and to > a > > missing call to tabbedPanel.setOutputMarkupId(true) . > > > > Thank you for quick response. > > > > Regards, > > Ulrich Knaack > > > > > > > -Ursprüngliche Nachricht- > > > Von: Martin Grigorov [mailto:mgrigo...@apache.org] > > > Gesendet: Mittwoch, 3. Mai 2017 15:04 > > > An: users@wicket.apache.org > > > Betreff: Re: Modal dialog, form validation in AjaxBootstrapTabbedPanel > > > > > > Hi, > > > > > > I think I see the problem. > > > When using AjaxBootstrapTabbedPanel the tabs' content is loaded one at > a > > > time. This makes it hard to validate the complete form because not all > > > fields are available at any time. > > > You may need to use > > > https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/wicket- > > > 7.x/bootstrap- > > > core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/ta > > > bs/ClientSideBootstrapTabbedPanel.java > > > instead. It will switch the tabs > > > via JavaScript and make the validation once you use the submit button. > > > If this doesn't help you then I'll try to take a look at your > application > > > after work! > > > > > > Martin Grigorov > > > Wicket Training and Consulting > > > https://twitter.com/mtgrigorov > > > > > > > > > - > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > -- Regards - Ernesto Reinaldo Barreiro
Re: Modal dialog, form validation in AjaxBootstrapTabbedPanel
Hi Ulrich, I'm glad to hear that it worked so easily! Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Mon, May 8, 2017 at 12:05 PM, Knaack, Ulrich < ulrich.kna...@lgln.niedersachsen.de> wrote: > Hi Martin, > > sorry for late replying. Issues in another project prevented me from > testing your hint. > > Using ClientSideBootstrapTabbedPanel solved my problem completely. > I simply replaced "class MyAjaxTabbedPanel extends > AjaxBootstrapTabbedPanel" > with > "class MyAjaxTabbedPanel extends ClientSideBootstrapTabbedPanel " > and removed unnecessary methods. > Then, wicket gave me useful hints related to a ClassCastException and to a > missing call to tabbedPanel.setOutputMarkupId(true) . > > Thank you for quick response. > > Regards, > Ulrich Knaack > > > > -Ursprüngliche Nachricht- > > Von: Martin Grigorov [mailto:mgrigo...@apache.org] > > Gesendet: Mittwoch, 3. Mai 2017 15:04 > > An: users@wicket.apache.org > > Betreff: Re: Modal dialog, form validation in AjaxBootstrapTabbedPanel > > > > Hi, > > > > I think I see the problem. > > When using AjaxBootstrapTabbedPanel the tabs' content is loaded one at a > > time. This makes it hard to validate the complete form because not all > > fields are available at any time. > > You may need to use > > https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/wicket- > > 7.x/bootstrap- > > core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/ta > > bs/ClientSideBootstrapTabbedPanel.java > > instead. It will switch the tabs > > via JavaScript and make the validation once you use the submit button. > > If this doesn't help you then I'll try to take a look at your application > > after work! > > > > Martin Grigorov > > Wicket Training and Consulting > > https://twitter.com/mtgrigorov > > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: Modal dialog, form validation in AjaxBootstrapTabbedPanel
Hi Martin, sorry for late replying. Issues in another project prevented me from testing your hint. Using ClientSideBootstrapTabbedPanel solved my problem completely. I simply replaced "class MyAjaxTabbedPanel extends AjaxBootstrapTabbedPanel" with "class MyAjaxTabbedPanel extends ClientSideBootstrapTabbedPanel " and removed unnecessary methods. Then, wicket gave me useful hints related to a ClassCastException and to a missing call to tabbedPanel.setOutputMarkupId(true) . Thank you for quick response. Regards, Ulrich Knaack > -Ursprüngliche Nachricht- > Von: Martin Grigorov [mailto:mgrigo...@apache.org] > Gesendet: Mittwoch, 3. Mai 2017 15:04 > An: users@wicket.apache.org > Betreff: Re: Modal dialog, form validation in AjaxBootstrapTabbedPanel > > Hi, > > I think I see the problem. > When using AjaxBootstrapTabbedPanel the tabs' content is loaded one at a > time. This makes it hard to validate the complete form because not all > fields are available at any time. > You may need to use > https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/wicket- > 7.x/bootstrap- > core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/ta > bs/ClientSideBootstrapTabbedPanel.java > instead. It will switch the tabs > via JavaScript and make the validation once you use the submit button. > If this doesn't help you then I'll try to take a look at your application > after work! > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Modal dialog, form validation in AjaxBootstrapTabbedPanel - solved
Hi Martin, sorry for late replying. Issues in another project prevented me from testing your hint. Using ClientSideBootstrapTabbedPanel solved my problem completely. I simply replaced "class MyAjaxTabbedPanel extends AjaxBootstrapTabbedPanel" with "class MyAjaxTabbedPanel extends ClientSideBootstrapTabbedPanel " and removed unnecessary methods. Then, wicket gave me useful hints related to a ClassCastException and to a missing call to tabbedPanel.setOutputMarkupId(true) . Thank you for quick response. Regards, Ulrich Knaack > -Ursprüngliche Nachricht- > Von: Martin Grigorov [mailto:mgrigo...@apache.org] > Gesendet: Mittwoch, 3. Mai 2017 15:04 > An: users@wicket.apache.org > Betreff: Re: Modal dialog, form validation in AjaxBootstrapTabbedPanel > > Hi, > > I think I see the problem. > When using AjaxBootstrapTabbedPanel the tabs' content is loaded one at a > time. This makes it hard to validate the complete form because not all > fields are available at any time. > You may need to use > https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/wicket- > 7.x/bootstrap- > core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/ta > bs/ClientSideBootstrapTabbedPanel.java > instead. It will switch the tabs > via JavaScript and make the validation once you use the submit button. > If this doesn't help you then I'll try to take a look at your application > after work! > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Modal dialog, form validation in AjaxBootstrapTabbedPanel
Hi, I think I see the problem. When using AjaxBootstrapTabbedPanel the tabs' content is loaded one at a time. This makes it hard to validate the complete form because not all fields are available at any time. You may need to use https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/wicket-7.x/bootstrap-core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/tabs/ClientSideBootstrapTabbedPanel.java instead. It will switch the tabs via JavaScript and make the validation once you use the submit button. If this doesn't help you then I'll try to take a look at your application after work! Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Wed, May 3, 2017 at 2:19 PM, Knaack, Ulrich < ulrich.kna...@lgln.niedersachsen.de> wrote: > Hi, > > I've to create a modal dialog which contains a AjaxBootstrapTabbedPanel > with two or more tabs. > All tabs belong to the same form. Each tab contains required input fields, > select boxes > or drop down choices. Until now, I don't use own validators, but this is a > future task. > > I was able to trigger the validation when switching between the tabs. > > When I use the dialog like variant A and B, I get proper feedback from > validation. > > Variant A > 1. open the dialog > 2. closing the dialog via submit button immediately results in > feedback message "please enter a value in field..." > > Variant B > 1. open the dialog > 2. switch to another tab without filling required fields on initial > tab gives also "please enter a value in ..." > > Variant C - validation problem > Using the dialog in this way doesn't result in feedback messages: > 1. open the dialog > 2. enter all required values on the initial tab > 3. don't enter values in required fields on another tab > 4. use the submit button to close the diaolg: no feedback message!!, > but there has to be one or more > > In Variant C, no logging output from the method > BootstrapAjaxButton#onError() is printed. > > I'm using Wicket 7.6.0 and Wicket-Bootstrap 0.10.11 > > The attachement contains a MCVE which can be run via test class > StartTryOut. > > > Regards, > Ulrich Knaack > > Landesamt für Geoinformation und Landesvermessung Niedersachsen (LGLN) > - Landesvermessung und Geobasisinformation - Landesbetrieb - > Fachgebiet 224 - Geodateninfrastruktur > Podbielskistraße 331, 30659 Hannover > Tel.:+49 511 64609-287 > Fax: +49 511 64609-161 > mailto:ulrich.kna...@lgln.niedersachsen.de > www.lgln.niedersachsen.de > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org >
Re: AjaxButton submits despite form validation failure?
Awaiting confirmation from my co-worker that it worked, but we think we figured it out. He was adding the error message to the page level, above the form. Once he added the message to the form instead, the onSubmit does not fire. We saw the bit in the javadoc suggesting that we use AbstractFormValidator and he is going that way. The only odd part is that it seems like we've done this before and not had this problem. But we haven't gone looking, so can't be sure. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxButton-submits-despite-form-validation-failure-tp4677463p4677472.html Sent from the Users forum 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
Re: AjaxButton submits despite form validation failure?
Hi, If you can reproduce this in a quickstart app with 6.26.0/7.6.0/8.0.0-M4 then please create a ticket in JIRA and attach it! Thank you! Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Mon, Mar 27, 2017 at 7:28 PM, Entropy wrote: > A co-worker is having an issue that I am confused by. He has an AjaxButton > submitting a form that (among other things) hides on WebMarkupContainer and > shows another. But the form goes through a custom IFormValidator that > compares a few fields. > > When he violates the error, we can see the code invoke the error() method > on > the validator. Yet the onSubmit() fires anyway. He swears that it didn't > before he recently redid the page in accordance with requirements changes. > The main thrust of the changes is that it used to be that both > WebMarkupContainers were visible the entire time. > > Also, when the code get to onSubmit, he checks the message list, and it > shows as empty. He didn't turn defaultFormProcessing off, and I'm not even > sure what to look for at this point. I'm kind of hoping this is some > common > pitfall that someone will recognize instantly. > > -- > View this message in context: http://apache-wicket.1842946. > n4.nabble.com/AjaxButton-submits-despite-form- > validation-failure-tp4677463.html > Sent from the Users forum 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 > >
AjaxButton submits despite form validation failure?
A co-worker is having an issue that I am confused by. He has an AjaxButton submitting a form that (among other things) hides on WebMarkupContainer and shows another. But the form goes through a custom IFormValidator that compares a few fields. When he violates the error, we can see the code invoke the error() method on the validator. Yet the onSubmit() fires anyway. He swears that it didn't before he recently redid the page in accordance with requirements changes. The main thrust of the changes is that it used to be that both WebMarkupContainers were visible the entire time. Also, when the code get to onSubmit, he checks the message list, and it shows as empty. He didn't turn defaultFormProcessing off, and I'm not even sure what to look for at this point. I'm kind of hoping this is some common pitfall that someone will recognize instantly. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxButton-submits-despite-form-validation-failure-tp4677463.html Sent from the Users forum 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
Re: Form Validation / Field visibility
Got it. Thank you! Em 3 de nov de 2016 20:35, "Sven Meier" escreveu: > Hi, > > your *IForm*Validator complains about some of its dependent components > being invisible. So no need to remove any validators. > > Your IFormValidator's getDependentFormComponents() should only return > visible components. > > Have fun > Sven > > > Am 03.11.2016 um 21:40 schrieb Marcel Barbosa Pinto: > >> Hello, >> >> I have a form which has some fields with validation attached to them. >> When the user authenticates I hide some form elements. >> >> When the form is submitted I receive a Warn log entry: >> >> o.a.wicket.markup.html.form.Form - IFormValidator in form `form` depends >> on >> a component that has been removed from the page or is no longer visible. >> Offending component id `email`. >> >> Should I always manually remove the validators from the components when >> hiding them? >> >> Thanks. >> >> >> > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: Form Validation / Field visibility
Hi, your *IForm*Validator complains about some of its dependent components being invisible. So no need to remove any validators. Your IFormValidator's getDependentFormComponents() should only return visible components. Have fun Sven Am 03.11.2016 um 21:40 schrieb Marcel Barbosa Pinto: Hello, I have a form which has some fields with validation attached to them. When the user authenticates I hide some form elements. When the form is submitted I receive a Warn log entry: o.a.wicket.markup.html.form.Form - IFormValidator in form `form` depends on a component that has been removed from the page or is no longer visible. Offending component id `email`. Should I always manually remove the validators from the components when hiding them? Thanks. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Form Validation / Field visibility
Hello, I have a form which has some fields with validation attached to them. When the user authenticates I hide some form elements. When the form is submitted I receive a Warn log entry: o.a.wicket.markup.html.form.Form - IFormValidator in form `form` depends on a component that has been removed from the page or is no longer visible. Offending component id `email`. Should I always manually remove the validators from the components when hiding them? Thanks. -- Marcel Barbosa Pinto 55 11 98255 8288
Re: Approach to changing value in input field before validation
Well, the user is entering a part number (SKU) and there are times where we’ve specified replacement SKUs. If I find only 1, then I want to replace and continue, but if I don’t, I want to continue the existing validation and maybe it finds a valid part or maybe it gives the user a message. But if I replace the 1 and it’s now in a discontinued state, I need to fail validation and let the user know. It’s not a typical e-commerce app, actually it’s a large CRM system, so there are times where I have to do unusual things to meet the users needs. The current application (desktop) leaves SKUA in the textfield, but gives you the validation messages for SKUB (assuming it fails). I felt that this was more confusing that swapping the input and then showing the user the replaced value along with the validation message that belongs to the new SKU (B) -Lon On Tue, Jul 26, 2016 at 8:07 AM, Martin Grigorov wrote: > Hi, > > I find it confusing that the user enters "A" and if the validation fails > (s)he sees "B". > Me, as a user, I'd ask myself: I've entered "A", why it tells me that "B" > is incorrect?! > > Maybe a better way is to use better error feedback messages than replacing > the user input ?! > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > On Tue, Jul 26, 2016 at 5:00 PM, Lon Varscsak > wrote: > > > Okay, that works. Do you think my approach to use a converter is > > appropriate or should I do it in another place (like validation)? > > > > Thanks for your input, > > > > Lon > > > > On Mon, Jul 25, 2016 at 9:46 PM, Martin Makundi < > > martin.maku...@koodaripalvelut.com> wrote: > > > > > We have made an utility method that uses reflection to set rawinput, > and > > > have found this very useful. > > > > > > You set both rawInput and rawInputArray > > > > > > ** > > > Martin > > > > > > 2016-07-26 1:18 GMT+03:00 Lon Varscsak : > > > > > > > Okay, so I have a need…I’m sure I’m going to get “why are you doing > > > that?”, > > > > but I have this need regardless and here’s what it is… :D > > > > > > > > User inputs “VALUEA”, I want to look up something in the database for > > > > “VALUEA”, and if conditions are met, replace that with “VALUEB” and > > > > continue with validation for the new value. However, the only way I > > can > > > > see to do this would be to update the *rawInput* value, which I do > not > > > have > > > > access to as a subclass (it’s private). > > > > > > > > So instead, I tried writing a converter, and it generally behaves as > I > > > want > > > > (it validates “VALUEB”), however if there’s a validation error on > > > “VALUEB” > > > > the rawInput is still “VALUEA”…so it’s a little confusing to the > user. > > > > > > > > I’m not sure that using a converter is the “right” approach, but it’s > > the > > > > closest I’ve come to a solution. > > > > > > > > Thoughts? > > > > > > > > Thanks, > > > > > > > > Lon > > > > > > > > > >
Re: Approach to changing value in input field before validation
Hi, I find it confusing that the user enters "A" and if the validation fails (s)he sees "B". Me, as a user, I'd ask myself: I've entered "A", why it tells me that "B" is incorrect?! Maybe a better way is to use better error feedback messages than replacing the user input ?! Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Tue, Jul 26, 2016 at 5:00 PM, Lon Varscsak wrote: > Okay, that works. Do you think my approach to use a converter is > appropriate or should I do it in another place (like validation)? > > Thanks for your input, > > Lon > > On Mon, Jul 25, 2016 at 9:46 PM, Martin Makundi < > martin.maku...@koodaripalvelut.com> wrote: > > > We have made an utility method that uses reflection to set rawinput, and > > have found this very useful. > > > > You set both rawInput and rawInputArray > > > > ** > > Martin > > > > 2016-07-26 1:18 GMT+03:00 Lon Varscsak : > > > > > Okay, so I have a need…I’m sure I’m going to get “why are you doing > > that?”, > > > but I have this need regardless and here’s what it is… :D > > > > > > User inputs “VALUEA”, I want to look up something in the database for > > > “VALUEA”, and if conditions are met, replace that with “VALUEB” and > > > continue with validation for the new value. However, the only way I > can > > > see to do this would be to update the *rawInput* value, which I do not > > have > > > access to as a subclass (it’s private). > > > > > > So instead, I tried writing a converter, and it generally behaves as I > > want > > > (it validates “VALUEB”), however if there’s a validation error on > > “VALUEB” > > > the rawInput is still “VALUEA”…so it’s a little confusing to the user. > > > > > > I’m not sure that using a converter is the “right” approach, but it’s > the > > > closest I’ve come to a solution. > > > > > > Thoughts? > > > > > > Thanks, > > > > > > Lon > > > > > >
Re: Approach to changing value in input field before validation
Okay, that works. Do you think my approach to use a converter is appropriate or should I do it in another place (like validation)? Thanks for your input, Lon On Mon, Jul 25, 2016 at 9:46 PM, Martin Makundi < martin.maku...@koodaripalvelut.com> wrote: > We have made an utility method that uses reflection to set rawinput, and > have found this very useful. > > You set both rawInput and rawInputArray > > ** > Martin > > 2016-07-26 1:18 GMT+03:00 Lon Varscsak : > > > Okay, so I have a need…I’m sure I’m going to get “why are you doing > that?”, > > but I have this need regardless and here’s what it is… :D > > > > User inputs “VALUEA”, I want to look up something in the database for > > “VALUEA”, and if conditions are met, replace that with “VALUEB” and > > continue with validation for the new value. However, the only way I can > > see to do this would be to update the *rawInput* value, which I do not > have > > access to as a subclass (it’s private). > > > > So instead, I tried writing a converter, and it generally behaves as I > want > > (it validates “VALUEB”), however if there’s a validation error on > “VALUEB” > > the rawInput is still “VALUEA”…so it’s a little confusing to the user. > > > > I’m not sure that using a converter is the “right” approach, but it’s the > > closest I’ve come to a solution. > > > > Thoughts? > > > > Thanks, > > > > Lon > > >
Re: Approach to changing value in input field before validation
We have made an utility method that uses reflection to set rawinput, and have found this very useful. You set both rawInput and rawInputArray ** Martin 2016-07-26 1:18 GMT+03:00 Lon Varscsak : > Okay, so I have a need…I’m sure I’m going to get “why are you doing that?”, > but I have this need regardless and here’s what it is… :D > > User inputs “VALUEA”, I want to look up something in the database for > “VALUEA”, and if conditions are met, replace that with “VALUEB” and > continue with validation for the new value. However, the only way I can > see to do this would be to update the *rawInput* value, which I do not have > access to as a subclass (it’s private). > > So instead, I tried writing a converter, and it generally behaves as I want > (it validates “VALUEB”), however if there’s a validation error on “VALUEB” > the rawInput is still “VALUEA”…so it’s a little confusing to the user. > > I’m not sure that using a converter is the “right” approach, but it’s the > closest I’ve come to a solution. > > Thoughts? > > Thanks, > > Lon >
Approach to changing value in input field before validation
Okay, so I have a need…I’m sure I’m going to get “why are you doing that?”, but I have this need regardless and here’s what it is… :D User inputs “VALUEA”, I want to look up something in the database for “VALUEA”, and if conditions are met, replace that with “VALUEB” and continue with validation for the new value. However, the only way I can see to do this would be to update the *rawInput* value, which I do not have access to as a subclass (it’s private). So instead, I tried writing a converter, and it generally behaves as I want (it validates “VALUEB”), however if there’s a validation error on “VALUEB” the rawInput is still “VALUEA”…so it’s a little confusing to the user. I’m not sure that using a converter is the “right” approach, but it’s the closest I’ve come to a solution. Thoughts? Thanks, Lon
Re: Resource caching - validation of user entered version
Thanks for fast answer :) -- Daniel On Tue, May 31, 2016 at 4:54 PM, Martin Grigorov wrote: > Hi, > > The version is intended to be used by the browser for client side caching, > not by Wicket. That's why it is just stripped off by Wicket without any > validation. > Actually if Wicket rejects it then you won't be able to update your > resources in new application versions. > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > On Tue, May 31, 2016 at 4:51 PM, Daniel Stoch > wrote: > >> Hi, >> >> By default Wicket (6.x) uses IResourceCachingStrategy which generates >> resource urls like this one: >> >> http://host/myapp/wicket/resource/com.mycompany.BootstrapBehavior/js/timepicker/bootstrap-timepicker-ver-1E0DAFB24FE33C93370DE13BF6FFE77F.js >> >> But as a user I can generate almost any version number in this url and >> it will be handled correctly by Wicket. For example these urls still >> work ok: >> >> http://host/myapp/wicket/resource/com.mycompany.BootstrapBehavior/js/timepicker/bootstrap-timepicker-ver-123.js >> >> http://host/myapp/wicket/resource/com.mycompany.BootstrapBehavior/js/timepicker/bootstrap-timepicker-ver--alert('1');return >> false;.js >> >> Is it a desired behavior or maybe Wicket should reject such >> "incorrect" versions? Could it be some security issue? >> >> -- >> Best regards, >> Daniel >> >> - >> 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
Re: Resource caching - validation of user entered version
Hi, The version is intended to be used by the browser for client side caching, not by Wicket. That's why it is just stripped off by Wicket without any validation. Actually if Wicket rejects it then you won't be able to update your resources in new application versions. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Tue, May 31, 2016 at 4:51 PM, Daniel Stoch wrote: > Hi, > > By default Wicket (6.x) uses IResourceCachingStrategy which generates > resource urls like this one: > > http://host/myapp/wicket/resource/com.mycompany.BootstrapBehavior/js/timepicker/bootstrap-timepicker-ver-1E0DAFB24FE33C93370DE13BF6FFE77F.js > > But as a user I can generate almost any version number in this url and > it will be handled correctly by Wicket. For example these urls still > work ok: > > http://host/myapp/wicket/resource/com.mycompany.BootstrapBehavior/js/timepicker/bootstrap-timepicker-ver-123.js > > http://host/myapp/wicket/resource/com.mycompany.BootstrapBehavior/js/timepicker/bootstrap-timepicker-ver--alert('1');return > false;.js > > Is it a desired behavior or maybe Wicket should reject such > "incorrect" versions? Could it be some security issue? > > -- > Best regards, > Daniel > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Resource caching - validation of user entered version
Hi, By default Wicket (6.x) uses IResourceCachingStrategy which generates resource urls like this one: http://host/myapp/wicket/resource/com.mycompany.BootstrapBehavior/js/timepicker/bootstrap-timepicker-ver-1E0DAFB24FE33C93370DE13BF6FFE77F.js But as a user I can generate almost any version number in this url and it will be handled correctly by Wicket. For example these urls still work ok: http://host/myapp/wicket/resource/com.mycompany.BootstrapBehavior/js/timepicker/bootstrap-timepicker-ver-123.js http://host/myapp/wicket/resource/com.mycompany.BootstrapBehavior/js/timepicker/bootstrap-timepicker-ver--alert('1');return false;.js Is it a desired behavior or maybe Wicket should reject such "incorrect" versions? Could it be some security issue? -- Best regards, Daniel - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket Validation
Ah cool, I’ll give that a whirl. -Lon On Thu, May 19, 2016 at 9:55 AM, Ernesto Reinaldo Barreiro < reier...@gmail.com> wrote: > IComponentAssignedModel? > > On Thu, May 19, 2016 at 6:52 PM, Lon Varscsak > wrote: > > > Hey Sven, I considered this, but realized that models don’t have access > to > > the component, so I wasn’t sure how I would report the errors. Any tips > > would be appreciated. > > > > -Lon > > > > On Thu, May 19, 2016 at 7:08 AM, Sven Meier wrote: > > > > > Hi, > > > > > > you could use a custom model wrapper catching your exceptions and > > > reporting them as error messages. > > > > > > Have fun > > > Sven > > > > > > > > > > > > On 19.05.2016 00:23, Lon Varscsak wrote: > > > > > >> Hey guys, > > >> > > >> I have some business logic where when the set method is called, it > first > > >> validates the value. In finding a “bad” value, it then throws a > custom > > >> validation exception. We use this pattern all over the place. > > >> > > >> Is there some way to handle this situation so that it’s a valid wicket > > >> validation error? > > >> > > >> Thanks for any tips. > > >> > > >> -Lon (Wicket Newb :D) > > >> > > >> > > > > > > - > > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > > > > > > -- > Regards - Ernesto Reinaldo Barreiro >
Re: Wicket Validation
IComponentAssignedModel? On Thu, May 19, 2016 at 6:52 PM, Lon Varscsak wrote: > Hey Sven, I considered this, but realized that models don’t have access to > the component, so I wasn’t sure how I would report the errors. Any tips > would be appreciated. > > -Lon > > On Thu, May 19, 2016 at 7:08 AM, Sven Meier wrote: > > > Hi, > > > > you could use a custom model wrapper catching your exceptions and > > reporting them as error messages. > > > > Have fun > > Sven > > > > > > > > On 19.05.2016 00:23, Lon Varscsak wrote: > > > >> Hey guys, > >> > >> I have some business logic where when the set method is called, it first > >> validates the value. In finding a “bad” value, it then throws a custom > >> validation exception. We use this pattern all over the place. > >> > >> Is there some way to handle this situation so that it’s a valid wicket > >> validation error? > >> > >> Thanks for any tips. > >> > >> -Lon (Wicket Newb :D) > >> > >> > > > > - > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > -- Regards - Ernesto Reinaldo Barreiro
Re: Wicket Validation
Hey Martin, well the exception is being thrown during the form submit processing, but it just ends up as a big error on the page. On Thu, May 19, 2016 at 12:00 AM, Martin Grigorov wrote: > Hi, > > Wicket cares about validation errors only during form submit processing. > In your case you could throw ConversionException during the 'convertInput' > phase. > I.e. in the beginning of the form submit processing Wicket will try to > convert the String input to the backend object (e.g. a String to Integer, > or to a Date, or to something custom). > If the setters are used at that time and the input is not valid then throw > ConversionException. > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > On Thu, May 19, 2016 at 12:23 AM, Lon Varscsak > wrote: > > > Hey guys, > > > > I have some business logic where when the set method is called, it first > > validates the value. In finding a “bad” value, it then throws a custom > > validation exception. We use this pattern all over the place. > > > > Is there some way to handle this situation so that it’s a valid wicket > > validation error? > > > > Thanks for any tips. > > > > -Lon (Wicket Newb :D) > > >
Re: Wicket Validation
Hey Sven, I considered this, but realized that models don’t have access to the component, so I wasn’t sure how I would report the errors. Any tips would be appreciated. -Lon On Thu, May 19, 2016 at 7:08 AM, Sven Meier wrote: > Hi, > > you could use a custom model wrapper catching your exceptions and > reporting them as error messages. > > Have fun > Sven > > > > On 19.05.2016 00:23, Lon Varscsak wrote: > >> Hey guys, >> >> I have some business logic where when the set method is called, it first >> validates the value. In finding a “bad” value, it then throws a custom >> validation exception. We use this pattern all over the place. >> >> Is there some way to handle this situation so that it’s a valid wicket >> validation error? >> >> Thanks for any tips. >> >> -Lon (Wicket Newb :D) >> >> > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: Wicket Validation
Hi, you could use a custom model wrapper catching your exceptions and reporting them as error messages. Have fun Sven On 19.05.2016 00:23, Lon Varscsak wrote: Hey guys, I have some business logic where when the set method is called, it first validates the value. In finding a “bad” value, it then throws a custom validation exception. We use this pattern all over the place. Is there some way to handle this situation so that it’s a valid wicket validation error? Thanks for any tips. -Lon (Wicket Newb :D) - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket Validation
Hi, Wicket cares about validation errors only during form submit processing. In your case you could throw ConversionException during the 'convertInput' phase. I.e. in the beginning of the form submit processing Wicket will try to convert the String input to the backend object (e.g. a String to Integer, or to a Date, or to something custom). If the setters are used at that time and the input is not valid then throw ConversionException. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, May 19, 2016 at 12:23 AM, Lon Varscsak wrote: > Hey guys, > > I have some business logic where when the set method is called, it first > validates the value. In finding a “bad” value, it then throws a custom > validation exception. We use this pattern all over the place. > > Is there some way to handle this situation so that it’s a valid wicket > validation error? > > Thanks for any tips. > > -Lon (Wicket Newb :D) >
Wicket Validation
Hey guys, I have some business logic where when the set method is called, it first validates the value. In finding a “bad” value, it then throws a custom validation exception. We use this pattern all over the place. Is there some way to handle this situation so that it’s a valid wicket validation error? Thanks for any tips. -Lon (Wicket Newb :D)
Re: when a Form validation fails, components don't refresh correctly
Hi, calling myTextField.clearInput() would be the recommended solution. Have fun Sven On 11.05.2016 17:31, marco di gasbarro wrote: Hey All, I'm dealing with a user interaction problem after a failed Form validation. In fact I have a Form with two components: a DropDownChoice and a TextField. The DropDownChoice has an AjaxFormComponentUpdatingBehavior attached, which modifies the TextField's model object and then adds the TextField itself to the AjaxRequestTarget. When the Form validation fails, the DropDown's Behavior changes the TextField's underlying model object correctly, adds the TextField to the Target, but the TextField renders with the old converted input, which doesn't reflect the changes. If on the one hand it looks like a Wicket's feature to leave the Form components showing the input which couldn't be validated, on the other hand a flexible user interaction should let the component to be notified about the changes occurred on its model object. By now I work around it calling inputChanged() on the TextField before adding it to the Target. Is there any best practice which covers this use case? Here is a snippet: new AjaxFormComponentUpdatingBehavior("change"){ @Override protected void onUpdate(AjaxRequestTarget target) { //update the TextField model object getMyFormModelObject().setMyTextFieldModelObject(newValue); //temporary workaround myTextField.inputChanged(); //add the textfield to the Target target.add(myTextField); } } Thanks in advance for your help! -- Marco - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
when a Form validation fails, components don't refresh correctly
Hey All, I'm dealing with a user interaction problem after a failed Form validation. In fact I have a Form with two components: a DropDownChoice and a TextField. The DropDownChoice has an AjaxFormComponentUpdatingBehavior attached, which modifies the TextField's model object and then adds the TextField itself to the AjaxRequestTarget. When the Form validation fails, the DropDown's Behavior changes the TextField's underlying model object correctly, adds the TextField to the Target, but the TextField renders with the old converted input, which doesn't reflect the changes. If on the one hand it looks like a Wicket's feature to leave the Form components showing the input which couldn't be validated, on the other hand a flexible user interaction should let the component to be notified about the changes occurred on its model object. By now I work around it calling inputChanged() on the TextField before adding it to the Target. Is there any best practice which covers this use case? Here is a snippet: new AjaxFormComponentUpdatingBehavior("change"){ @Override protected void onUpdate(AjaxRequestTarget target) { //update the TextField model object getMyFormModelObject().setMyTextFieldModelObject(newValue); //temporary workaround myTextField.inputChanged(); //add the textfield to the Target target.add(myTextField); } } Thanks in advance for your help! -- Marco
Antwort: Re: Form: Validation of JSR-303 Class Level Constraints
Hi Martin, Yes but the 42Lines library did contain ValidationForm which allowed validation of class level constraints. This component is missing in the merged library. If it has been removed for some reason, is there another way to do class level validation? Eugen Berenstein Hi, 42Lines Bean Validation has been merged to Wicket since 6.x The code is at https://github.com/apache/wicket/tree/master/wicket-bean- validation Examples: http://examples7x.wicket.apache.org/bean-validation/ Documentation: https://ci.apache.org/projects/wicket/guide/7.x/guide/forms2.html#forms2_4 > On Nov 27 2015, at 1:16 pm, Eugen Berenstein <eugen.berenst...@laekh.de> wrote: > > Hi, I need to apply cross field constraints to an object with JSR-303. As I understand class level constraints are the correct tool for this. Is there a way in Wicket 7 or 8 to apply these on a Form's model object? > > I have tried the 42lines:wicket-bean-validation library but the release 1.1 seems to be incompatible this Wicket 7. I also have overwritten Form.onValidateModelObjects() and added the validation there which does work but seems insufficient to me. > > Thank You, Eugen Berenstein
Re: Form: Validation of JSR-303 Class Level Constraints
Hi, 42Lines Bean Validation has been merged to Wicket since 6.x The code is at https://github.com/apache/wicket/tree/master/wicket-bean- validation Examples: http://examples7x.wicket.apache.org/bean-validation/ Documentation: https://ci.apache.org/projects/wicket/guide/7.x/guide/forms2.html#forms2_4 > On Nov 27 2015, at 1:16 pm, Eugen Berenstein <eugen.berenst...@laekh.de> wrote: > > Hi, I need to apply cross field constraints to an object with JSR-303. As I understand class level constraints are the correct tool for this. Is there a way in Wicket 7 or 8 to apply these on a Form's model object? > > I have tried the 42lines:wicket-bean-validation library but the release 1.1 seems to be incompatible this Wicket 7. I also have overwritten Form.onValidateModelObjects() and added the validation there which does work but seems insufficient to me. > > Thank You, Eugen Berenstein
Form: Validation of JSR-303 Class Level Constraints
Hi, I need to apply cross field constraints to an object with JSR-303. As I understand class level constraints are the correct tool for this. Is there a way in Wicket 7 or 8 to apply these on a Form's model object? I have tried the 42lines:wicket-bean-validation library but the release 1.1 seems to be incompatible this Wicket 7. I also have overwritten Form.onValidateModelObjects() and added the validation there which does work but seems insufficient to me. Thank You, Eugen Berenstein
Re: form AjaxFormComponentUpdatingBehavior validation
OnDomReadyHeaderItem.forScript('Thanks Sven') I also added OnEventHeaderItem.forScript("window", "onunload", "mousedownHappened = true") to the button. Everything work nicely except when an onunload event is fired and the textfield is empty. In this case the ajaxFormComponentUpdatingBehavior.onEvent() is called and the formComponent.validate(); François Meillet Le 18 févr. 2015 à 16:36, Sven Meier a écrit : > I didn't try it, but this would be the rough equivalent of > http://stackoverflow.com/a/13729993/1041336 in Wicket: > > textField.add(new AjaxFormComponentUpdatingBehavior("blur") { > updateAjaxAttributes(ara) { >ara.getAjaxCallListeners().add(new AjaxCallListener() { > getPrecondition() { >return "return |mousedownHappened| === false; "; > } >}); > } > }); > > button.add(new Behavior() { > renderHead(c, r) { >r.render(OnDomReaderHeaderItem.forScript("$(" + c.getMarkupId() + > ").on('mousedown', function() { mousedownHappened = true });"); > } > }); > > Regards > Sven > > > On 18.02.2015 15:59, Francois Meillet wrote: >> Thanks Sven, >> >> yes this is a javascript issue. >> >> I look for a nice way (a la Wicket) to disable the blur event when onunload >> and onclick are fired. >> >> François Meillet >> >> >> >> >> >> Le 18 févr. 2015 à 12:40, Sven Meier a écrit : >> >>> Hi, >>> >>> this is rather a JavaScript issue: >>> >>> http://stackoverflow.com/questions/13729837/jquery-stop-blur-event-when-clicking-submit-button >>> >>> Regards >>> Sven >>> >>> On 18.02.2015 11:35, Francois Meillet wrote: >>>> Hi All, >>>> >>>> >>>> 1) I have a Form with a Textfield which has a >>>> AjaxFormComponentUpdatingBehavior (blur) >>>> >>>> When the entire form is submitted (via an AjaxButton) >>>> the ajaxFormComponentUpdatingBehavior.onEvent() is called >>>> then the formComponent.validate() is called >>>> and then when the form.validate() is called >>>> formComponent.validate() is called again. >>>> >>>> Could it possible to avoid this double validation ? >>>> Do I have to override AjaxFormComponentUpdatingBehavior.onEvent() ? ... >>>> or there is a simple way to do this ? >>>> >>>> >>>> >>>> 2) is it possible to remove a formComponent's validator just after the >>>> button.submit() and before the form.onFormSubmitted() is called >>>> >>>> >>>> >>>> 3) When the I leave a page (without submitting) with a formComponent which >>>> has a AjaxFormComponentUpdatingBehavior (blur), >>>> the ajaxFormComponentUpdatingBehavior.onEvent() is called and then the >>>> validation. >>>> Can I avoid the ajaxFormComponentUpdatingBehavior.onEvent() ? >>>> >>>> >>>> Best regards >>>> François Meillet >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>> >>> - >>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>> For additional commands, e-mail: users-h...@wicket.apache.org >>> >> >
Re: form AjaxFormComponentUpdatingBehavior validation
I didn't try it, but this would be the rough equivalent of http://stackoverflow.com/a/13729993/1041336 in Wicket: textField.add(new AjaxFormComponentUpdatingBehavior("blur") { updateAjaxAttributes(ara) { ara.getAjaxCallListeners().add(new AjaxCallListener() { getPrecondition() { return "return |mousedownHappened| === false; "; } }); } }); button.add(new Behavior() { renderHead(c, r) { r.render(OnDomReaderHeaderItem.forScript("$(" + c.getMarkupId() + ").on('mousedown', function() { mousedownHappened = true });"); } }); Regards Sven On 18.02.2015 15:59, Francois Meillet wrote: Thanks Sven, yes this is a javascript issue. I look for a nice way (a la Wicket) to disable the blur event when onunload and onclick are fired. François Meillet Le 18 févr. 2015 à 12:40, Sven Meier a écrit : Hi, this is rather a JavaScript issue: http://stackoverflow.com/questions/13729837/jquery-stop-blur-event-when-clicking-submit-button Regards Sven On 18.02.2015 11:35, Francois Meillet wrote: Hi All, 1) I have a Form with a Textfield which has a AjaxFormComponentUpdatingBehavior (blur) When the entire form is submitted (via an AjaxButton) the ajaxFormComponentUpdatingBehavior.onEvent() is called then the formComponent.validate() is called and then when the form.validate() is called formComponent.validate() is called again. Could it possible to avoid this double validation ? Do I have to override AjaxFormComponentUpdatingBehavior.onEvent() ? ... or there is a simple way to do this ? 2) is it possible to remove a formComponent's validator just after the button.submit() and before the form.onFormSubmitted() is called 3) When the I leave a page (without submitting) with a formComponent which has a AjaxFormComponentUpdatingBehavior (blur), the ajaxFormComponentUpdatingBehavior.onEvent() is called and then the validation. Can I avoid the ajaxFormComponentUpdatingBehavior.onEvent() ? Best regards François Meillet - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: form AjaxFormComponentUpdatingBehavior validation
Thanks Sven, yes this is a javascript issue. I look for a nice way (a la Wicket) to disable the blur event when onunload and onclick are fired. François Meillet Le 18 févr. 2015 à 12:40, Sven Meier a écrit : > Hi, > > this is rather a JavaScript issue: > > http://stackoverflow.com/questions/13729837/jquery-stop-blur-event-when-clicking-submit-button > > Regards > Sven > > On 18.02.2015 11:35, Francois Meillet wrote: >> Hi All, >> >> >> 1) I have a Form with a Textfield which has a >> AjaxFormComponentUpdatingBehavior (blur) >> >> When the entire form is submitted (via an AjaxButton) >> the ajaxFormComponentUpdatingBehavior.onEvent() is called >> then the formComponent.validate() is called >> and then when the form.validate() is called >> formComponent.validate() is called again. >> >> Could it possible to avoid this double validation ? >> Do I have to override AjaxFormComponentUpdatingBehavior.onEvent() ? ... or >> there is a simple way to do this ? >> >> >> >> 2) is it possible to remove a formComponent's validator just after the >> button.submit() and before the form.onFormSubmitted() is called >> >> >> >> 3) When the I leave a page (without submitting) with a formComponent which >> has a AjaxFormComponentUpdatingBehavior (blur), >> the ajaxFormComponentUpdatingBehavior.onEvent() is called and then the >> validation. >> Can I avoid the ajaxFormComponentUpdatingBehavior.onEvent() ? >> >> >> Best regards >> François Meillet >> >> >> >> >> >> >> > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org >
Re: form AjaxFormComponentUpdatingBehavior validation
Hi, this is rather a JavaScript issue: http://stackoverflow.com/questions/13729837/jquery-stop-blur-event-when-clicking-submit-button Regards Sven On 18.02.2015 11:35, Francois Meillet wrote: Hi All, 1) I have a Form with a Textfield which has a AjaxFormComponentUpdatingBehavior (blur) When the entire form is submitted (via an AjaxButton) the ajaxFormComponentUpdatingBehavior.onEvent() is called then the formComponent.validate() is called and then when the form.validate() is called formComponent.validate() is called again. Could it possible to avoid this double validation ? Do I have to override AjaxFormComponentUpdatingBehavior.onEvent() ? ... or there is a simple way to do this ? 2) is it possible to remove a formComponent's validator just after the button.submit() and before the form.onFormSubmitted() is called 3) When the I leave a page (without submitting) with a formComponent which has a AjaxFormComponentUpdatingBehavior (blur), the ajaxFormComponentUpdatingBehavior.onEvent() is called and then the validation. Can I avoid the ajaxFormComponentUpdatingBehavior.onEvent() ? Best regards François Meillet - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
form AjaxFormComponentUpdatingBehavior validation
Hi All, 1) I have a Form with a Textfield which has a AjaxFormComponentUpdatingBehavior (blur) When the entire form is submitted (via an AjaxButton) the ajaxFormComponentUpdatingBehavior.onEvent() is called then the formComponent.validate() is called and then when the form.validate() is called formComponent.validate() is called again. Could it possible to avoid this double validation ? Do I have to override AjaxFormComponentUpdatingBehavior.onEvent() ? ... or there is a simple way to do this ? 2) is it possible to remove a formComponent's validator just after the button.submit() and before the form.onFormSubmitted() is called 3) When the I leave a page (without submitting) with a formComponent which has a AjaxFormComponentUpdatingBehavior (blur), the ajaxFormComponentUpdatingBehavior.onEvent() is called and then the validation. Can I avoid the ajaxFormComponentUpdatingBehavior.onEvent() ? Best regards François Meillet
Re: Wierd Validation
> Am 23.01.2015 um 21:24 schrieb Entropy : > > We have a page where the client has made some odd demands for behavior and I > need to know if they are possible and if so, how one would do them. > > The basic gist is that the user is filling out alot of data and may not know > it all right away. So they can enter the record in a sort of "scratch" way, > leaving fields blank initially. But, if they enter something, we will apply > full validation. > > However, we want to tell the user that the field is required...but save it > anyway. So imagine the user fills out 50% of the fields, sees errors on > blur for format failures, then hits save. The form puts yellow warning > messages on the component feedback panel instead of red error messages > saying "Field required" or whatever. > > But, on the server, as long as all the red validations (the formats) are > satisfied, we still want to save the record so that the user can come back > and fill the rest later. > > There are several things I don't know how to do here: > 1) How do I add a different css class to a warning message as opposed to a n > error. Just one way would be that you could use behaviors and add them to your form components and output a message in the style you want. http://wicket.apache.org/guide/guide/advanced.html > 2) How do I get control if only warnings are issued so I can save. There is a validate method you can override for your requirements (see custom validations) http://wicket.apache.org/guide/guide/forms2.html > 3) I still want to show a message up top in the message panel that alerts > them to look at their controls for warnings/error. > Use the FeebackPanel for this you can add it to the Form: org.apache.wicket.markup.html.panel.FeedbackPanel > > Help? > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Wierd-Validation-tp4669105.html > Sent from the Users forum 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 Hope this helps you out. kind regards Tobias
Wierd Validation
We have a page where the client has made some odd demands for behavior and I need to know if they are possible and if so, how one would do them. The basic gist is that the user is filling out alot of data and may not know it all right away. So they can enter the record in a sort of "scratch" way, leaving fields blank initially. But, if they enter something, we will apply full validation. However, we want to tell the user that the field is required...but save it anyway. So imagine the user fills out 50% of the fields, sees errors on blur for format failures, then hits save. The form puts yellow warning messages on the component feedback panel instead of red error messages saying "Field required" or whatever. But, on the server, as long as all the red validations (the formats) are satisfied, we still want to save the record so that the user can come back and fill the rest later. There are several things I don't know how to do here: 1) How do I add a different css class to a warning message as opposed to a n error. 2) How do I get control if only warnings are issued so I can save. 3) I still want to show a message up top in the message panel that alerts them to look at their controls for warnings/error. Help? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wierd-Validation-tp4669105.html Sent from the Users forum 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
Re: validation in form component panels in RefreshingView
Hi Martin, I'm sorry to bother you with a second post. I have reproduced the behaviour described above in a simple project ( refreshingview.zip <http://apache-wicket.1842946.n4.nabble.com/file/n4669090/refreshingview.zip> ). Also, I put the mercurial project on bitbucket( hg clone https://luc...@bitbucket.org/lucast/refreshingview). The behaviour is as follow. Step 1, choose a number (3, for example) from the drop down list. A list of 3 entries of text fields will be displayed. Step 2, choose a different number (2, for example) from the drop down list. Only one entry of text field will be displayed. Even though the list model has 2 entries, not one. When an entry from the drop down list, located in HomePage is selected, PersonListFormComponentPanel is updated. On running the debugger, I noticed that inside ReuseIfModelsEqualStrategy.getItems(), (line 86), on the bit that compares if (oldItem == null), on the first run, oldItem *is* null. On the second run, *oldItem* *is not*. That is why PersonRefreshingView.populateItem() is not called the second time a number is selected from the drop down list. How can I set *oldItem* to null so that it follows the very same behaviour as when executed the first time? If you happen to look inside PersonListFormComponentPanel.PersonRefreshingView, you will notice that I have implemented PersonModel, with equals and hashcode functions. Anyway, this is something I honestly cannot get my head around. I have tried for days now and I find it most puzzling. Any tips, or hints in the right direction will be much appreciated. Thanks, once more, Lucas -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/validation-in-form-component-panels-in-RefreshingView-tp4669068p4669090.html Sent from the Users forum 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
Re: validation in form component panels in RefreshingView
Hi Martin, Thank you for taking the time to reply. I have implemented hashcode and equals on the object, and the Model class used inside the RefreshingView and the ListModel class that is passed to the RefreshingView. In order to be able to display the right number of entries, I clear the list inside the ListModel and populate it again with N numbers of initialized objects. The variables in those objects are all null. This works on the first run but not on the second. In stepping through the code with debugger, hashcode and equal are called only for the the actual object and the model object, not for the ListModel. Since all objects are empty (no variables have been populated) the models and the actual objects all return the same hash code. But this surely is of no relevance since I am using a List, not a set. I've been looking at this for a while, and perhaps I have lost the sense of perspective, but I cannot see what I am doing wrong. Kind regards, Lucas -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/validation-in-form-component-panels-in-RefreshingView-tp4669068p4669088.html Sent from the Users forum 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
Re: validation in form component panels in RefreshingView
Hi, On Thu, Jan 22, 2015 at 3:16 PM, lucast wrote: > Thank you, Martin, > > I have used ReuseIfModelsEqualStrategy and the validation message side of > it > work but now I have a different problem. > > When I navigate away from the form panel, update the list of objects and > navigate back to the FormComponentPanel that holds the RefreshingView, only > one item from the list gets displayed. > > I use a ListModel to pass the list of objects to the FormComponentPanel. > > When used for the first time, the RefreshingView calls getItemModels() and > populateItem(), but after updating the ListModel, RefreshingView only calls > getItemModels() and *not* populateItem(). > > Would you happen to know why that is? > > If I use DefaultItemReuseStrategy.getInstance() then getItemModels() and > populateItem() get called every time. But that just takes me back to square > 1. > > I'm not sure if this is relevant. ReuseIfModelsEqualStrategy documentation > states that " the model and not the model object needs to implement the > Object.equals(Object) and Object.hashCode() methods". > > I'm terribly sorry but I'm not sure completely understand that statement. > Would that be something to do with the RefreshingView not displaying all > items in the list model. > This says that your model object has to have proper impls of #equals() and #hashCode() methods. Just like when you put instances of this class in HashMap. I guess this will solve your problem. > > On trying to interpret that statement, on RefreshingView.getItemModels(), I > return an anonymous class that extends ModelIteratorAdapter. And on > ModelIteratorAdapter.model, I return an custom Model with extends Model Application Object>. It is there that I implement hashcode and equals. But > the problem still persists. > > I hope I'm not making things more confusing by writing extensively, but I > just wanted to put it out there, in case there was something simple and > small that I am missing. > > Thanks in advance, > Lucas > > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/validation-in-form-component-panels-in-RefreshingView-tp4669068p4669081.html > Sent from the Users forum 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 > >
Re: validation in form component panels in RefreshingView
Thank you, Martin, I have used ReuseIfModelsEqualStrategy and the validation message side of it work but now I have a different problem. When I navigate away from the form panel, update the list of objects and navigate back to the FormComponentPanel that holds the RefreshingView, only one item from the list gets displayed. I use a ListModel to pass the list of objects to the FormComponentPanel. When used for the first time, the RefreshingView calls getItemModels() and populateItem(), but after updating the ListModel, RefreshingView only calls getItemModels() and *not* populateItem(). Would you happen to know why that is? If I use DefaultItemReuseStrategy.getInstance() then getItemModels() and populateItem() get called every time. But that just takes me back to square 1. I'm not sure if this is relevant. ReuseIfModelsEqualStrategy documentation states that " the model and not the model object needs to implement the Object.equals(Object) and Object.hashCode() methods". I'm terribly sorry but I'm not sure completely understand that statement. Would that be something to do with the RefreshingView not displaying all items in the list model. On trying to interpret that statement, on RefreshingView.getItemModels(), I return an anonymous class that extends ModelIteratorAdapter. And on ModelIteratorAdapter.model, I return an custom Model with extends Model. It is there that I implement hashcode and equals. But the problem still persists. I hope I'm not making things more confusing by writing extensively, but I just wanted to put it out there, in case there was something simple and small that I am missing. Thanks in advance, Lucas -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/validation-in-form-component-panels-in-RefreshingView-tp4669068p4669081.html Sent from the Users forum 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
Re: validation in form component panels in RefreshingView
org.apache.wicket.markup.repeater.RefreshingView#setItemReuseStrategy(org.apache.wicket.markup.repeater.ReuseIfModelsEqualStrategy#getInstance()) Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Wed, Jan 21, 2015 at 6:59 PM, lucast wrote: > Dear forum, > > I'm implementing a tabbed panel. > On first panel, user selects number of items. On second tab, user enters > details for each item. > > I've implemented a RefreshingView so that the number of items on list > reflects the number of items selected by user. > > To bundle all of the fields together I use a form component panel and for > each entry on the RefreshingView, I add a form component panel. > > The text fields have FieldDecorators, as explained on the Apache Wicket > Cookbook, chapter 3. > > The problem is that when I submit the form, the error messages for each > field are not shown on the text field FieldDecorators. > > If I use RepeatingView, error messages are displayed as intended. But my > list is dynamic. > > How can I get the proper validation message displayed inside the form > component panel, used in a RefreshingView? > > Thanks in advance, > Lucas > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/validation-in-form-component-panels-in-RefreshingView-tp4669068.html > Sent from the Users forum 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 > >
validation in form component panels in RefreshingView
Dear forum, I'm implementing a tabbed panel. On first panel, user selects number of items. On second tab, user enters details for each item. I've implemented a RefreshingView so that the number of items on list reflects the number of items selected by user. To bundle all of the fields together I use a form component panel and for each entry on the RefreshingView, I add a form component panel. The text fields have FieldDecorators, as explained on the Apache Wicket Cookbook, chapter 3. The problem is that when I submit the form, the error messages for each field are not shown on the text field FieldDecorators. If I use RepeatingView, error messages are displayed as intended. But my list is dynamic. How can I get the proper validation message displayed inside the form component panel, used in a RefreshingView? Thanks in advance, Lucas -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/validation-in-form-component-panels-in-RefreshingView-tp4669068.html Sent from the Users forum 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
Re: String length validation and windows line breaks
Hi, I think there are no such changes in Wicket lately. Just tried "a\r\nb".length and "a\n\rb".length in Google Chrome's console and both return 4 Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Sat, Jul 12, 2014 at 12:22 PM, Thomas Heigl wrote: > Hey all, > > Recenty, probably after moving to Wicket 6.16, we see some strange behavior > for TextAreas. > > We have been using a JavaScript library to limit the number of characters a > user can enter in a textbox for years. Now we started getting validation > exceptions on the server that the user entered a too many characters. It > turned out that Wicket counts Windows '\r\n' as two characters, while JS > counts them as one. > > We can easily fix that with a custom StringConverter that replaces Windows > linebreaks, but I was wondering if there were some recent changes in Wicket > that could have triggered these issues? > > Cheers, > > Thomas >
String length validation and windows line breaks
Hey all, Recenty, probably after moving to Wicket 6.16, we see some strange behavior for TextAreas. We have been using a JavaScript library to limit the number of characters a user can enter in a textbox for years. Now we started getting validation exceptions on the server that the user entered a too many characters. It turned out that Wicket counts Windows '\r\n' as two characters, while JS counts them as one. We can easily fix that with a custom StringConverter that replaces Windows linebreaks, but I was wondering if there were some recent changes in Wicket that could have triggered these issues? Cheers, Thomas
Re: How can I display modal dialog only if validation is sucessful?
Thanks Francois, I've been busy on another task. I'll look at the code soon. Bruce Sent from my iPad > On May 22, 2014, at 5:48 AM, Francois Meillet > wrote: > > Hi Bruce, > > This is just one solution : > Have a look at http://pastebin.com/03DF5pcw > > > François Meillet > Formation Wicket - Développement Wicket > > > > > >> Le 21 mai 2014 à 16:15, Bruce Lombardi a écrit : >> >> Hi, >> >> >> >> I have a form with several question that a user must answer. If the answers >> are correct, an email is sent to the user and the user is returned to the >> login page. That's a bit abrupt for the user and I would like to provide a >> simple modal dialog that confirms that the email is sent before sending them >> to the home page. However, if the answers to the questions are not correct, >> then a feedback panel must be displayed. >> >> >> >> I've looked at the approaches to providing a confirmation panel in this link >> https://cwiki.apache.org/confluence/display/WICKET/Getting+user+confirmation >> and other places, but I am having a problem with the approach. The >> JavaScript seems to run as soon as the button is clicked - before onSubmit >> or onValidate runs on the server. So I can't stop the pop-up from showing >> if the questions were not answered correctly. >> >> >> >> Does anyone know a way I can display the modal dialog only after validation >> has run? >> >> >> >> Thanks, >> >> >> >> Bruce > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How can I display modal dialog only if validation is sucessful?
Hi Bruce, This is just one solution : Have a look at http://pastebin.com/03DF5pcw François Meillet Formation Wicket - Développement Wicket Le 21 mai 2014 à 16:15, Bruce Lombardi a écrit : > Hi, > > > > I have a form with several question that a user must answer. If the answers > are correct, an email is sent to the user and the user is returned to the > login page. That's a bit abrupt for the user and I would like to provide a > simple modal dialog that confirms that the email is sent before sending them > to the home page. However, if the answers to the questions are not correct, > then a feedback panel must be displayed. > > > > I've looked at the approaches to providing a confirmation panel in this link > https://cwiki.apache.org/confluence/display/WICKET/Getting+user+confirmation > and other places, but I am having a problem with the approach. The > JavaScript seems to run as soon as the button is clicked - before onSubmit > or onValidate runs on the server. So I can't stop the pop-up from showing > if the questions were not answered correctly. > > > > Does anyone know a way I can display the modal dialog only after validation > has run? > > > > Thanks, > > > > Bruce > > >
How can I display modal dialog only if validation is sucessful?
Hi, I have a form with several question that a user must answer. If the answers are correct, an email is sent to the user and the user is returned to the login page. That's a bit abrupt for the user and I would like to provide a simple modal dialog that confirms that the email is sent before sending them to the home page. However, if the answers to the questions are not correct, then a feedback panel must be displayed. I've looked at the approaches to providing a confirmation panel in this link https://cwiki.apache.org/confluence/display/WICKET/Getting+user+confirmation and other places, but I am having a problem with the approach. The JavaScript seems to run as soon as the button is clicked - before onSubmit or onValidate runs on the server. So I can't stop the pop-up from showing if the questions were not answered correctly. Does anyone know a way I can display the modal dialog only after validation has run? Thanks, Bruce
Re: AjaxTabbedPanel and validation for all tabs
The reason I want to avoid client tabs is speed. The form has several components that are slow to render (drop downs filled with REST service calls). I ended up implementing this as follows: - An AjaxTabbedPanel with links that will submit the form currently shown (I look for the first child of class Form of the AjaxTabbedPanel but one could as well submit a form containing the AjaxTabbedPanel) - My own validation utility that validates objects using wicket's validation framework. This is more or less an object that allows the developer to attach validators to class properties. Then an object is validated by generating a Validatable object for each property and running the attached validators. Finally, errors are propagated to form components by matching the component id to the property name. - Validation runs on the entire object, not just one tab. So: - Every time the user tries to switch tabs, the form is submitted, and the entire object is validated. The errors relevant to the current tab are isolated and shown in a feedback panel inside the tab, and the tab-switching is cancelled. If there are no errors relevant to the current tab, the tab-switching goes ahead. - If the user clicks save, again the current form is submitted and the entire object is validated. If there are any errors, the user gets a popup message that indicates which tabs have errors. There are a few more details involved which I won't go into unless somebody wants to get the full story. Overall it's not a super clean solution, but it is not too bad either. Wicket again came through and made it possible to implement this scenario without much pain. And I'm quite happy with my "object validator". Because now I get a validator that can run both on a form (by validating it's model object) and on another channel of data entry (say a REST service) that reuses wicket's validators and error messages (so it's consistent with other forms that directly use wicket's validation). Marios On Wed, May 7, 2014 at 9:43 AM, Tom Götz wrote: > The easiest solution I can think of. Why do you want to avoid that? > > Cheers, >-Tom > > On 06.05.2014, at 16:13, mscoon wrote: > > > Is there a way to solve this? Client side tabs are a solution I guess but > > one I'd like to avoid if possible. > > > > >
Re: AjaxTabbedPanel and validation for all tabs
My recommendation would be to use bean validation and Ajax to update the UI. On Tuesday, May 6, 2014, mscoon wrote: > Hi all, > > I have a complex form for editing existing objects. I am planning to use > AjaxTabbedPanel with adapted ajax links for the tabs to submit the current > tab when the user switches tabs. > > There will be a "save" button under the tabbed panel that will save the > entire object. > > For new objects, I could force the user to visit all tabs before allowing > them to save, to guarantee that the validators have ran for all form > components and all tabs. > > The twist here is that the object, when loaded, may be invalid. But I don't > want to force the user to visit all tabs when editing an existing object > because it will very unfriendly (imagine the user wanting to update just > one field in the first tab and being forced to visit all five tabs before > saving). > > So I am looking for a way to make sure that all validators run when the > user clicks "save". As far as I understand there is no way to force all > wicket validators to execute because the request will only contain post > data for the active tab. > > Is there a way to solve this? Client side tabs are a solution I guess but > one I'd like to avoid if possible. > > I did consider moving my validation logic to a server side validation > method. The problem here is that you cannot leverage wicket's existing > validators and error messages and also it becomes considerably harder to > provide visual feedback for errors (e.g. highlight the components with > errors). On the plus side, you do have a validation method that can be > reused if you have alternate methods for updating the same data (e.g. via a > REST service). > > Are there any pointers on using server side validation with wicket forms? > > Thanks in advance, > Marios >
Re: AjaxTabbedPanel and validation for all tabs
The easiest solution I can think of. Why do you want to avoid that? Cheers, -Tom On 06.05.2014, at 16:13, mscoon wrote: > Is there a way to solve this? Client side tabs are a solution I guess but > one I'd like to avoid if possible.
AjaxTabbedPanel and validation for all tabs
Hi all, I have a complex form for editing existing objects. I am planning to use AjaxTabbedPanel with adapted ajax links for the tabs to submit the current tab when the user switches tabs. There will be a "save" button under the tabbed panel that will save the entire object. For new objects, I could force the user to visit all tabs before allowing them to save, to guarantee that the validators have ran for all form components and all tabs. The twist here is that the object, when loaded, may be invalid. But I don't want to force the user to visit all tabs when editing an existing object because it will very unfriendly (imagine the user wanting to update just one field in the first tab and being forced to visit all five tabs before saving). So I am looking for a way to make sure that all validators run when the user clicks "save". As far as I understand there is no way to force all wicket validators to execute because the request will only contain post data for the active tab. Is there a way to solve this? Client side tabs are a solution I guess but one I'd like to avoid if possible. I did consider moving my validation logic to a server side validation method. The problem here is that you cannot leverage wicket's existing validators and error messages and also it becomes considerably harder to provide visual feedback for errors (e.g. highlight the components with errors). On the plus side, you do have a validation method that can be reused if you have alternate methods for updating the same data (e.g. via a REST service). Are there any pointers on using server side validation with wicket forms? Thanks in advance, Marios
Re: Validation not working in Model Window on Dynamic rows addition
Yes, it is just experiment. Also, when the Addrow is clicked, the validation is not getting fired and the form is getting null, as i'm clueless why it is not working only in ModelWindow and how it is working in regular page. Thanks Venky -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Validation-not-working-in-Model-Window-on-Dynamic-rows-addition-tp4665011p4665035.html Sent from the Users forum 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
Re: Validation not working in Model Window on Dynamic rows addition
Hi, Sorry, I don't see anything suspicious. The only thing is that your submit button is AjaxLink, AjaxSubmitLink is commented. But I guess you did this just to experiment. Martin Grigorov Wicket Training and Consulting On Tue, Mar 18, 2014 at 5:54 PM, wicket_new_user wrote: > ReportFiltersPanel.html > < > http://apache-wicket.1842946.n4.nabble.com/file/n4665013/ReportFiltersPanel.html > > > ReportFiltersPanel.java > < > http://apache-wicket.1842946.n4.nabble.com/file/n4665013/ReportFiltersPanel.java > > > > Martin, > Uploaded both the Java and HTML files for complete reference. > > New row is added between 161 - 192 lines of code which is called at line > 118 > in the uploaded file. > > Thanks > Venky > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Validation-not-working-in-Model-Window-on-Dynamic-rows-addition-tp4665011p4665013.html > Sent from the Users forum 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 > >
Re: Validation not working in Model Window on Dynamic rows addition
ReportFiltersPanel.html <http://apache-wicket.1842946.n4.nabble.com/file/n4665013/ReportFiltersPanel.html> ReportFiltersPanel.java <http://apache-wicket.1842946.n4.nabble.com/file/n4665013/ReportFiltersPanel.java> Martin, Uploaded both the Java and HTML files for complete reference. New row is added between 161 - 192 lines of code which is called at line 118 in the uploaded file. Thanks Venky -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Validation-not-working-in-Model-Window-on-Dynamic-rows-addition-tp4665011p4665013.html Sent from the Users forum 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
Re: Validation not working in Model Window on Dynamic rows addition
Hi, Show us the involved code. How do you add a new row ? Martin Grigorov Wicket Training and Consulting On Tue, Mar 18, 2014 at 5:31 PM, wicket_new_user wrote: > Hi, > > I've a requirement where, the rows needs to be added dynamically on click > of > a button/hyperlink. If a new Row needs to be added, then the previous rows > needs to be filled by the user. > Also on Click of Submit button, have to check all the rows are filled or > not. > > The above case is working fine in regular Page, but failing in Modal dialog > box. > Whats happening is, > when the new row is added, "form" is available. > Once try to add new row or click submit button, the form is getting as > null and unable to get any validations if exists or the form is not getting > submitted. > > > Thanks in advance > > Best regards > Venky > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Validation-not-working-in-Model-Window-on-Dynamic-rows-addition-tp4665011.html > Sent from the Users forum 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 > >
Validation not working in Model Window on Dynamic rows addition
Hi, I've a requirement where, the rows needs to be added dynamically on click of a button/hyperlink. If a new Row needs to be added, then the previous rows needs to be filled by the user. Also on Click of Submit button, have to check all the rows are filled or not. The above case is working fine in regular Page, but failing in Modal dialog box. Whats happening is, when the new row is added, "form" is available. Once try to add new row or click submit button, the form is getting as null and unable to get any validations if exists or the form is not getting submitted. Thanks in advance Best regards Venky -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Validation-not-working-in-Model-Window-on-Dynamic-rows-addition-tp4665011.html Sent from the Users forum 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
Re: wicketstuff-lazymodel and wicket-bean-validation
60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110) at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175) at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68) 377 [main] WARN RequestCycleExtra - Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.536 sec Running org.wicketstuff.lazymodel.LazyColumnTest Regards, Gabriel. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicketstuff-lazymodel-and-wicket-bean-validation-tp4660857p4660935.html Sent from the Users forum 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicketstuff-lazymodel and wicket-bean-validation
at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110) at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175) at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68) 377 [main] WARN RequestCycleExtra - Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.536 sec Running org.wicketstuff.lazymodel.LazyColumnTest Regards, Gabriel. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicketstuff-lazymodel-and-wicket-bean-validation-tp4660857p4660935.html Sent from the Users forum 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
RE: Forcing Form Validation from another Form's onValidate()
Actually, I figured it out. All the validators are getting called from the inner form. But there was an NullPointerException in the first validator which blocked all the others and I wasn't seeing them. Thanks for your help. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Forcing-Form-Validation-from-another-Form-s-onValidate-tp4660895p4660918.html Sent from the Users forum 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
RE: Forcing Form Validation from another Form's onValidate()
Looking further at my code, I see that the custom validators from the inner form DO get called; but the one that doesn't get called is .setRequired(true). There is one component in the inner form which is setRequired(true). And that validation is bypassed for some reason, although all the other ones are not. Any thoughts on this? Thanks for your replies. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Forcing-Form-Validation-from-another-Form-s-onValidate-tp4660895p4660917.html Sent from the Users forum 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
Re: wicketstuff-lazymodel and wicket-bean-validation
Hi Gabriel, LazyModel implements IPropertyReflectionAwareModel now, so integration with beanvalidation should work out-of-the-box with the next release. Best regards Sven On 08/13/2013 09:40 PM, Gabriel Landon wrote: The previous code was flawed. Here's the right one! It's far from perfect but as I'm using only IObjectClassAwareModel models it's working! public class LazyModelPropertyResolver implements IPropertyResolver { @Override public Property resolveProperty(final FormComponent component) { IModel model = component.getModel(); while (true) { if (model == null) { return null; } if (model instanceof LazyModel) { break; } if (model instanceof IWrapModel) { model = ((IWrapModel) model).getWrappedModel(); continue; } return null; } final LazyModel lazyModel = (LazyModel) model; //I'm using only IObjectClassAwareModel if (lazyModel.getTarget() instanceof IObjectClassAwareModel) { // le nom de la proprité (qui peut être dans une chaine du genre "foo.bar.baz"). String fieldName = lazyModel.getPath(); if (fieldName.contains(".")) { fieldName = StringUtils.substringAfterLast(fieldName, "."); // on prend le dernier champ } return new Property(((IObjectClassAwareModel) lazyModel.getTarget()).getObjectClass(), fieldName); } return null; } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicketstuff-lazymodel-and-wicket-bean-validation-tp4660857p4660872.html Sent from the Users forum 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Forcing Form Validation from another Form's onValidate()
In the final HTML, my form is flattened out, there is only . That's because Wicket supports nested forms but HTML does not. Wicket will hide any inner tags but keep the Form object references. See section 10.5 Nested Forms of the Wicket Free Guide for more details. http://wicket.apache.org/learn/books/freeguide.html In my Wicket markup, the structure is: PANEL -> FORM -> SecondPanel -> SecondForm The main PANEL's FORM is being submitted, and validated. But the "SecondForm" validation never gets called. So you want to validate the inner nested form when submitting the outer parent form. I take it that's the first use-case described at: https://cwiki.apache.org/confluence/display/WICKET/Nested+Forms all forms enabled outer form submitted Outer Middle Inner *S* S S Looking over the Form's validateComponents() method it does a post order traversal of all form components. I would say, create a quick-start so we better understand how your code is configured because as far as I recall this is the default behavior. Perhaps I'm wrong, but at least a quick-start would aid in helping you without guessing. To create a quick start see: http://wicket.apache.org/start/quickstart.html ~ Thank you, Paul Bors -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Forcing-Form-Validation-from-anot her-Form-s-onValidate-tp4660895p4660905.html Sent from the Users forum 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Forcing Form Validation from another Form's onValidate()
In the final HTML, my form is flattened out, there is only . In my Wicket markup, the structure is: PANEL -> FORM -> SecondPanel -> SecondForm The main PANEL's FORM is being submitted, and validated. But the "SecondForm" validation never gets called. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Forcing-Form-Validation-from-another-Form-s-onValidate-tp4660895p4660905.html Sent from the Users forum 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
RE: Forcing Form Validation from another Form's onValidate()
Have you checked the Wiki pages? https://cwiki.apache.org/confluence/display/WICKET/Nested+Forms Which use-case are your referring to again? ~ Thank you, Paul Bors -Original Message- From: eugenebalt [mailto:eugeneb...@yahoo.com] Sent: Wednesday, August 14, 2013 2:20 PM To: users@wicket.apache.org Subject: Forcing Form Validation from another Form's onValidate() I have a Panel (P1) which contains its own form (P1_F1). The P1 panel also contains another panel inside itself, P1_A, which has its own inner form (let's call it P1_A_F1). Whenever the P_F1's validation is called, I also have to call the P1_A_F1 form validation. It doesn't get called automatically. How can I achieve that? In the P1_F1, I am catching onValidate() and overriding it. The problem is, to call the validate() method, I need a FormComponent, not a Form. So I can find the right form to additionally validate, but the method is not available without a FormComponent. Any ideas? Thanks P1_F1's onValidate captured: @Override protected void onValidate() { Panel P1_A = (Panel)get("P1_A"); Form P1_A_F1 = (Form)P1_A.get("P1_A_F1"); // how to force validation now on P1_A_F1? } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Forcing-Form-Validation-from-anot her-Form-s-onValidate-tp4660895.html Sent from the Users forum 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Forcing Form Validation from another Form's onValidate()
I have a Panel (P1) which contains its own form (P1_F1). The P1 panel also contains another panel inside itself, P1_A, which has its own inner form (let's call it P1_A_F1). Whenever the P_F1's validation is called, I also have to call the P1_A_F1 form validation. It doesn't get called automatically. How can I achieve that? In the P1_F1, I am catching onValidate() and overriding it. The problem is, to call the validate() method, I need a FormComponent, not a Form. So I can find the right form to additionally validate, but the method is not available without a FormComponent. Any ideas? Thanks P1_F1's onValidate captured: @Override protected void onValidate() { Panel P1_A = (Panel)get("P1_A"); Form P1_A_F1 = (Form)P1_A.get("P1_A_F1"); // how to force validation now on P1_A_F1? } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Forcing-Form-Validation-from-another-Form-s-onValidate-tp4660895.html Sent from the Users forum 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
Re: wicketstuff-lazymodel and wicket-bean-validation
The previous code was flawed. Here's the right one! It's far from perfect but as I'm using only IObjectClassAwareModel models it's working! public class LazyModelPropertyResolver implements IPropertyResolver { @Override public Property resolveProperty(final FormComponent component) { IModel model = component.getModel(); while (true) { if (model == null) { return null; } if (model instanceof LazyModel) { break; } if (model instanceof IWrapModel) { model = ((IWrapModel) model).getWrappedModel(); continue; } return null; } final LazyModel lazyModel = (LazyModel) model; //I'm using only IObjectClassAwareModel if (lazyModel.getTarget() instanceof IObjectClassAwareModel) { // le nom de la proprité (qui peut être dans une chaine du genre "foo.bar.baz"). String fieldName = lazyModel.getPath(); if (fieldName.contains(".")) { fieldName = StringUtils.substringAfterLast(fieldName, "."); // on prend le dernier champ } return new Property(((IObjectClassAwareModel) lazyModel.getTarget()).getObjectClass(), fieldName); } return null; } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicketstuff-lazymodel-and-wicket-bean-validation-tp4660857p4660872.html Sent from the Users forum 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
Re: wicketstuff-lazymodel and wicket-bean-validation
Thank you very Sven. Here's what I've done for the 2nd solution (base on DefaultPropertyResolver) : public class LazyModelPropertyResolver implements IPropertyResolver { @Override public Property resolveProperty(final FormComponent component) { IModel model = component.getModel(); while (true) { if (model == null) { return null; } if (model instanceof LazyModel) { break; } if (model instanceof IWrapModel) { model = ((IWrapModel) model).getWrappedModel(); continue; } return null; } final LazyModel lazyModel = (LazyModel) model; // le nom de la proprité (qui peut être dans une chaine du genre "foo.bar.baz"). String fieldName = lazyModel.getPath(); if (fieldName.contains(".")) { fieldName = StringUtils.substringAfterLast(fieldName, "."); // on prend le dernier champ } return new Property(lazyModel.getObjectClass(), fieldName); } } For the 1st solution I cannot overrides/extends LazyModel as its construtor is private. Also I'm not a reflection guru, so I'm a bit lost on how to get the getter and setter from the LazyModel. I need to provide those 3 methods : -public Field getPropertyField(); -public Method getPropertyGetter(); -public Method getPropertySetter(); I've seen methods like "methodResolver.getSetter" and "methodResolver.getMethod" in the StackIterator but have not found how to use them... Any help on this would be nice also :-). Gabriel. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicketstuff-lazymodel-and-wicket-bean-validation-tp4660857p4660871.html Sent from the Users forum 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