validating a form that is not visible
I have a top-level form. The top-level form contains two nested forms. The nested forms are inside of a TabbedPanel so only one is visible at a time. The save button for the top-level form is always visible. The save button submits the top-level form and submitting the top-level form also has the effect of submitting the nested forms. This all is correct and works as it should. The issue is that Wicket (correctly) only validates the form that is on the tab that is visible. The form that is on the tab that is not visible is not actually being submitted so it doesn't get validated. In the past, I've prevented the user from switching tabs if one of the tabs contained a validation error, but I can't do that in this case. When the top-level form is submitted, is there a way I can mark both forms as visible and have Wicket validate both forms? Thanks Andrew
Re: 6.19.0 release date?
6.19 only or 7.0.0 too ? Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Jan 22, 2015 at 3:21 PM, Martijn Dashorst martijn.dasho...@gmail.com wrote: I'll see if I can build a release this weekend (or tomorrow) Martijn On Thu, Jan 22, 2015 at 12:50 PM, Tom Götz t...@decoded.de wrote: Hi there, are there already considerations for a release date of 6.19.0? Cheers, -Tom - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Become a Wicket expert, learn from the best: http://wicketinaction.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: 6.19.0 release date?
I'll see if I can build a release this weekend (or tomorrow) Martijn On Thu, Jan 22, 2015 at 12:50 PM, Tom Götz t...@decoded.de wrote: Hi there, are there already considerations for a release date of 6.19.0? Cheers, -Tom - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Become a Wicket expert, learn from the best: http://wicketinaction.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: validating a form that is not visible
Use a client side TAB...? So, visibility is handled at the client On Thu, Jan 22, 2015 at 11:51 AM, Andrew Geery andrew.ge...@gmail.com wrote: I have a top-level form. The top-level form contains two nested forms. The nested forms are inside of a TabbedPanel so only one is visible at a time. The save button for the top-level form is always visible. The save button submits the top-level form and submitting the top-level form also has the effect of submitting the nested forms. This all is correct and works as it should. The issue is that Wicket (correctly) only validates the form that is on the tab that is visible. The form that is on the tab that is not visible is not actually being submitted so it doesn't get validated. In the past, I've prevented the user from switching tabs if one of the tabs contained a validation error, but I can't do that in this case. When the top-level form is submitted, is there a way I can mark both forms as visible and have Wicket validate both forms? Thanks Andrew -- Regards - Ernesto Reinaldo Barreiro
Re: AttributeModifier not updated in Ajax request
Nope. Quickstart ? Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Jan 22, 2015 at 3:18 PM, Wayne W waynemailingli...@gmail.com wrote: Any ideas on this one? On Thu, Jan 15, 2015 at 2:31 PM, Wayne W waynemailingli...@gmail.com wrote: Hi, we have a list which gets updated via ajax. This works fine. I'm trying to get it so that the style attribute is updated as well. However even though I put break points in the getObject() and I can see its got the new User object the style attribute sent back via ajax is the old one even though the new user label is the correct one. Any ideas ? getAssignlistContainer().add( new DataViewUser(assignlist, provider) { @Override protected void populateItem(final ItemUser item) { item.setDefaultModel(new CompoundPropertyModelUser((IModelUser) item.getDefaultModel())); Label name = new Label(name); item.add(name); if (item.getModelObject() != null) name.add(AttributeModifier.replace(style, new ModelString() { @Override public String getObject() { User u = item.getModelObject(); String f = background-color: + LabelColourProvider.getColour(u.getInitials()); return f; } })); } });
Re: validating a form that is not visible
Hi, I think you will need to write custom tabbed panel that hides the tabs with JS on the client side. The problem with Wicket's default TabbedPanel is that it sees only one tab at a time - the active tab. I.e. the component tree is something like ...form:tabbedPanel:content:nestedFormX:... Switching the tabs replaces the content component and thus nestedFormX becomes nestedFormY. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Jan 22, 2015 at 1:51 PM, Andrew Geery andrew.ge...@gmail.com wrote: I have a top-level form. The top-level form contains two nested forms. The nested forms are inside of a TabbedPanel so only one is visible at a time. The save button for the top-level form is always visible. The save button submits the top-level form and submitting the top-level form also has the effect of submitting the nested forms. This all is correct and works as it should. The issue is that Wicket (correctly) only validates the form that is on the tab that is visible. The form that is on the tab that is not visible is not actually being submitted so it doesn't get validated. In the past, I've prevented the user from switching tabs if one of the tabs contained a validation error, but I can't do that in this case. When the top-level form is submitted, is there a way I can mark both forms as visible and have Wicket validate both forms? Thanks Andrew
Re: AttributeModifier not updated in Ajax request
Any ideas on this one? On Thu, Jan 15, 2015 at 2:31 PM, Wayne W waynemailingli...@gmail.com wrote: Hi, we have a list which gets updated via ajax. This works fine. I'm trying to get it so that the style attribute is updated as well. However even though I put break points in the getObject() and I can see its got the new User object the style attribute sent back via ajax is the old one even though the new user label is the correct one. Any ideas ? getAssignlistContainer().add( new DataViewUser(assignlist, provider) { @Override protected void populateItem(final ItemUser item) { item.setDefaultModel(new CompoundPropertyModelUser((IModelUser) item.getDefaultModel())); Label name = new Label(name); item.add(name); if (item.getModelObject() != null) name.add(AttributeModifier.replace(style, new ModelString() { @Override public String getObject() { User u = item.getModelObject(); String f = background-color: + LabelColourProvider.getColour(u.getInitials()); return f; } })); } });
Re: 6.19.0 release date?
Hi, for 6.19.0 or 7.0.0 too? This important because there are still some things to do in 7.0.0. This for example: https://github.com/apache/wicket/commit/f0340a3ef62a18df14badb26acee01bf102b9a2c#commitcomment-9351344 kind regards Tobias Am 22.01.2015 um 14:21 schrieb Martijn Dashorst martijn.dasho...@gmail.com: I'll see if I can build a release this weekend (or tomorrow) Martijn On Thu, Jan 22, 2015 at 12:50 PM, Tom Götz t...@decoded.de wrote: Hi there, are there already considerations for a release date of 6.19.0? Cheers, -Tom - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Become a Wicket expert, learn from the best: http://wicketinaction.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
6.19.0 release date?
Hi there, are there already considerations for a release date of 6.19.0? Cheers, -Tom - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: validating a form that is not visible
e.g. https://github.com/reiern70/wicket-bootstrap/blob/master/bootstrap-core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/tabs/ClientSideBootstrapTabbedPanel.java On Thu, Jan 22, 2015 at 11:57 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi, I think you will need to write custom tabbed panel that hides the tabs with JS on the client side. The problem with Wicket's default TabbedPanel is that it sees only one tab at a time - the active tab. I.e. the component tree is something like ...form:tabbedPanel:content:nestedFormX:... Switching the tabs replaces the content component and thus nestedFormX becomes nestedFormY. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Jan 22, 2015 at 1:51 PM, Andrew Geery andrew.ge...@gmail.com wrote: I have a top-level form. The top-level form contains two nested forms. The nested forms are inside of a TabbedPanel so only one is visible at a time. The save button for the top-level form is always visible. The save button submits the top-level form and submitting the top-level form also has the effect of submitting the nested forms. This all is correct and works as it should. The issue is that Wicket (correctly) only validates the form that is on the tab that is visible. The form that is on the tab that is not visible is not actually being submitted so it doesn't get validated. In the past, I've prevented the user from switching tabs if one of the tabs contained a validation error, but I can't do that in this case. When the top-level form is submitted, is there a way I can mark both forms as visible and have Wicket validate both forms? Thanks Andrew -- Regards - Ernesto Reinaldo Barreiro
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 ModelMy 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
Hi, On Thu, Jan 22, 2015 at 3:16 PM, lucast lucastol...@hotmail.com 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 ModelMy 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: Best practice integrating Wicket and 3rd party Ajax-component
Guten tag, Thorsten! On Thu, Jan 22, 2015 at 10:41 AM, Thorsten Schöning tschoen...@am-soft.de wrote: Hi all, I have some AutoComplete Ajax component which I need to integrate with Wicket. The component mainly gets configured an URL as target of it's request and expects the server to provide some JSON structure. One important thing to note is, that this component is part of a larger JS app consisting of many more components, with it's own build tools and integration into the site. So I can't extract that one component and build a Wicket component or such around it. Instead I want to keep all like it's is and just want to configure a Wicket entry point for the component, which than handles the requests and provides the response. From my currently limited knowledge of Wicket I thought of simply using a ResourceReference which gets mounted to a special URL, implementing the search logic needed. Because I won't use any templates or such and just need to provide some JSON. This is the best approach for your use case! Another way is to create a Component and use it as a context to decide what response to return. See https://github.com/wicketstuff/core/tree/master/jdk-1.7-parent/autocomplete-tagit-parent for such approach. Or is there any better approach I should have a look into for any reason? Thanks for your ideas! Mit freundlichen Grüßen, Thorsten Schöning -- Thorsten Schöning E-Mail: thorsten.schoen...@am-soft.de AM-SoFT IT-Systeme http://www.AM-SoFT.de/ Telefon...05151- 9468- 55 Fax...05151- 9468- 88 Mobil..0178-8 9468- 04 AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Best practice integrating Wicket and 3rd party Ajax-component
Hi all, I have some AutoComplete Ajax component which I need to integrate with Wicket. The component mainly gets configured an URL as target of it's request and expects the server to provide some JSON structure. One important thing to note is, that this component is part of a larger JS app consisting of many more components, with it's own build tools and integration into the site. So I can't extract that one component and build a Wicket component or such around it. Instead I want to keep all like it's is and just want to configure a Wicket entry point for the component, which than handles the requests and provides the response. From my currently limited knowledge of Wicket I thought of simply using a ResourceReference which gets mounted to a special URL, implementing the search logic needed. Because I won't use any templates or such and just need to provide some JSON. Or is there any better approach I should have a look into for any reason? Thanks for your ideas! Mit freundlichen Grüßen, Thorsten Schöning -- Thorsten Schöning E-Mail: thorsten.schoen...@am-soft.de AM-SoFT IT-Systeme http://www.AM-SoFT.de/ Telefon...05151- 9468- 55 Fax...05151- 9468- 88 Mobil..0178-8 9468- 04 AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Best practice integrating Wicket and 3rd party Ajax-component
Guten Tag Martin Grigorov, am Donnerstag, 22. Januar 2015 um 09:47 schrieben Sie: https://github.com/wicketstuff/core/tree/master/jdk-1.7-parent/autocomplete-tagit-parent That looks interesting, I have a closer look. Thanks! Mit freundlichen Grüßen, Thorsten Schöning -- Thorsten Schöning E-Mail: thorsten.schoen...@am-soft.de AM-SoFT IT-Systeme http://www.AM-SoFT.de/ Telefon...05151- 9468- 55 Fax...05151- 9468- 88 Mobil..0178-8 9468- 04 AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow - 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: validating a form that is not visible
Thanks so much for the info and the pointers! Andrew On Thu, Jan 22, 2015 at 7:03 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: e.g. https://github.com/reiern70/wicket-bootstrap/blob/master/bootstrap-core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/tabs/ClientSideBootstrapTabbedPanel.java On Thu, Jan 22, 2015 at 11:57 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi, I think you will need to write custom tabbed panel that hides the tabs with JS on the client side. The problem with Wicket's default TabbedPanel is that it sees only one tab at a time - the active tab. I.e. the component tree is something like ...form:tabbedPanel:content:nestedFormX:... Switching the tabs replaces the content component and thus nestedFormX becomes nestedFormY. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Jan 22, 2015 at 1:51 PM, Andrew Geery andrew.ge...@gmail.com wrote: I have a top-level form. The top-level form contains two nested forms. The nested forms are inside of a TabbedPanel so only one is visible at a time. The save button for the top-level form is always visible. The save button submits the top-level form and submitting the top-level form also has the effect of submitting the nested forms. This all is correct and works as it should. The issue is that Wicket (correctly) only validates the form that is on the tab that is visible. The form that is on the tab that is not visible is not actually being submitted so it doesn't get validated. In the past, I've prevented the user from switching tabs if one of the tabs contained a validation error, but I can't do that in this case. When the top-level form is submitted, is there a way I can mark both forms as visible and have Wicket validate both forms? Thanks Andrew -- Regards - Ernesto Reinaldo Barreiro
Handling stale Ajax Requests
Wicketeers, I have an issue to resolve and I hope someone can help. The user opens a link from 'Window 1' to open in new tab ('Window 2') and goes off and does a whole bunch of stuff in Window 2. After following a few links, the user returns to 'Window 1' and triggers an Ajax link. By now this page isn't in the page cache or whatever (at least I assume) and the Ajax link fails. Currently the behaviour is simply to forward to a brand new version of the page (i.e. the base of URL). Which is odd behaviour for the user, as all their state simply disappears. What I'd like to do is forward to the home page with a 'this page or link has expired' or similar so the difference isn't jarring, unfortunately I have no way to trap when this happens. No Exception is triggered in the IRequestCycleListener - I'd have expected a StalePageException or PageExpiredException, or similar but no exception is triggered here. Is there a way to handle this stale ajax request elegantly? Cheers, Col. EMAIL DISCLAIMER This email message and its attachments are confidential and may also contain copyright or privileged material. If you are not the intended recipient, you may not forward the email or disclose or use the information contained in it. If you have received this email message in error, please advise the sender immediately by replying to this email and delete the message and any associated attachments. Any views, opinions, conclusions, advice or statements expressed in this email message are those of the individual sender and should not be relied upon as the considered view, opinion, conclusions, advice or statement of this company except where the sender expressly, and with authority, states them to be the considered view, opinion, conclusions, advice or statement of this company. Every care is taken but we recommend that you scan any attachments for viruses.
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