Validating form components in a refreshing view
Hi there, I'm new to wicket and have a problem I can't find out for myself. Maybe some of you can help me out with this. I have a refreshingview with input fields each row. I can add new rows on click of a button, but when I submit the form, I want to validate 2 input fields from different rows. Everything I tried so far hasn't worked out, because I was only able to validate values from one row. Is it even possible to do something like this? Greetings Tobi - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Validating form components in a refreshing view
Hi ; Is the whole listview wrapped in 1 form or there is a form for each row? Josh. On Tue, Jul 17, 2012 at 10:02 AM, Tobias Knierim < tobias.knie...@googlemail.com> wrote: > Hi there, > I'm new to wicket and have a problem I can't find out for myself. > Maybe some of you can help me out with this. > > I have a refreshingview with input fields each row. I can add new rows > on click of a button, but when I submit the form, I want to validate 2 > input fields from different rows. Everything I tried so far hasn't > worked out, because I was only able to validate values from one row. > > Is it even possible to do something like this? > > > Greetings > Tobi > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: Validating form components in a refreshing view
Hi Josh, The whole view is wrapped in one form. Greetings Tobi Am 17.07.2012 um 09:04 schrieb Josh Kamau : > Hi ; > > Is the whole listview wrapped in 1 form or there is a form for each row? > > Josh. > > On Tue, Jul 17, 2012 at 10:02 AM, Tobias Knierim < > tobias.knie...@googlemail.com> wrote: > >> Hi there, >> I'm new to wicket and have a problem I can't find out for myself. >> Maybe some of you can help me out with this. >> >> I have a refreshingview with input fields each row. I can add new rows >> on click of a button, but when I submit the form, I want to validate 2 >> input fields from different rows. Everything I tried so far hasn't >> worked out, because I was only able to validate values from one row. >> >> Is it even possible to do something like this? >> >> >> Greetings >> Tobi >> >> - >> 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: Validating form components in a refreshing view
Tobi ; May be you can paste some code to show how you are constructing the forms... I believe if you just add the validators to the components and then submit the forms, it just works.. Josh. On Tue, Jul 17, 2012 at 10:22 AM, Tobias Knierim < tobias.knie...@googlemail.com> wrote: > Hi Josh, > > The whole view is wrapped in one form. > > Greetings > Tobi > > Am 17.07.2012 um 09:04 schrieb Josh Kamau : > > > Hi ; > > > > Is the whole listview wrapped in 1 form or there is a form for each row? > > > > Josh. > > > > On Tue, Jul 17, 2012 at 10:02 AM, Tobias Knierim < > > tobias.knie...@googlemail.com> wrote: > > > >> Hi there, > >> I'm new to wicket and have a problem I can't find out for myself. > >> Maybe some of you can help me out with this. > >> > >> I have a refreshingview with input fields each row. I can add new rows > >> on click of a button, but when I submit the form, I want to validate 2 > >> input fields from different rows. Everything I tried so far hasn't > >> worked out, because I was only able to validate values from one row. > >> > >> Is it even possible to do something like this? > >> > >> > >> Greetings > >> Tobi > >> > >> - > >> 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 > >
InvalidBehaviorIdException when closing modal windows
Hi, Can someone help me figure out what would be the cause why I am suddenly getting the following error when I close one of my modal windows? Cannot find behavior with id '0' on component 'org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow:srScreen' in page '[Page class = ums.app.NewSalesReport, id = 2, render count = 3]'. Perhaps the behavior did not properly implement getStatelessHint() and returned 'true' to indicate that it is stateless instead of returning 'false' to indicate that it is stateful. I have a class NewSalesReport where I add the modal window: srScreen = new ModalWindow("srScreen"); srScreen.setTitle("Sales Report Preview"); srScreen.setInitialHeight(500); srScreen.setInitialWidth(800); srScreen.setResizable(false); srScreen.setCssClassName(ModalWindow.CSS_CLASS_BLUE); srScreen.setPageCreator(new ModalWindow.PageCreator(){ private static final long serialVersionUID = 1L; public Page createPage(){ try { srPreviewWindow = new SRPreviewWindow(srScreen, shipmentID, grower.getDefaultModelObjectAsString()); } catch (ClassNotFoundException e) {e.printStackTrace();} catch (SQLException e) {e.printStackTrace();} return srPreviewWindow; } }); srScreen.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { public void onClose(AjaxRequestTarget target) { try { scp.setContainers(DbQueries.getGrowerUnreportedContainers(dataBase, grower.getDefaultModelObjectAsString())); target.add(scp); } catch (ClassNotFoundException e) {e.printStackTrace();} catch (SQLException e) {e.printStackTrace();} } }); srScreen.setOutputMarkupId(true); add(srScreen); And the window itself SRPreviewWindow: public SRPreviewWindow(final ModalWindow window, final int shipmentID, final String grower) throws ClassNotFoundException, SQLException{ ... add(new AjaxLink("cancel"){ public void onClick(AjaxRequestTarget target) { window.close(target); } }); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/InvalidBehaviorIdException-when-closing-modal-windows-tp4650560.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 form components in a refreshing view
Hi Josh, I just created a little example of how my application is working: I want to compare value2 from Entry1 with value1 from Entry2 and so on. Any ideas? Form form = new Form("form"); add(form); RefreshingView refreshingView = new RefreshingView("list", values) { @Override protected Iterator> getItemModels() { List entryList = values.getObject().getEntryList(); ModelIteratorAdapter mia = new ModelIteratorAdapter(entryList.iterator()) { @Override protected IModel model(Entry object) { return new CompoundPropertyModel(object); } }; return mia; } @Override protected void populateItem(Item item) { IModel model = item.getModel(); item.add(new TextField("textOne", new PropertyModel(model, "value1"))); item.add(new TextField("textTwo", new PropertyModel(model, "value2"))); } }; form.add(refreshingView); Tobi 2012/7/17 Josh Kamau : > Tobi ; > > May be you can paste some code to show how you are constructing the > forms... > > I believe if you just add the validators to the components and then submit > the forms, it just works.. > > Josh. > > On Tue, Jul 17, 2012 at 10:22 AM, Tobias Knierim < > tobias.knie...@googlemail.com> wrote: > >> Hi Josh, >> >> The whole view is wrapped in one form. >> >> Greetings >> Tobi >> >> Am 17.07.2012 um 09:04 schrieb Josh Kamau : >> >> > Hi ; >> > >> > Is the whole listview wrapped in 1 form or there is a form for each row? >> > >> > Josh. >> > >> > On Tue, Jul 17, 2012 at 10:02 AM, Tobias Knierim < >> > tobias.knie...@googlemail.com> wrote: >> > >> >> Hi there, >> >> I'm new to wicket and have a problem I can't find out for myself. >> >> Maybe some of you can help me out with this. >> >> >> >> I have a refreshingview with input fields each row. I can add new rows >> >> on click of a button, but when I submit the form, I want to validate 2 >> >> input fields from different rows. Everything I tried so far hasn't >> >> worked out, because I was only able to validate values from one row. >> >> >> >> Is it even possible to do something like this? >> >> >> >> >> >> Greetings >> >> Tobi >> >> >> >> - >> >> 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
Apache Wicket 6.0.0-beta3 is released
The Wicket team is proud to announce the third beta release of the Wicket 6.x series. This release is an intermediary release just before we give you 6.0.0 final. There are no more planned API breaks but if you find something that can be made better now it the time to discuss it! The next planned release is 6.0.0 final, so speak now or forever be silenced (or learn to live with it until 7.0.0 comes out). Any feedback about the new features, their implementation and their documentation is very welcome! New and Noteworthy in 6.0.0-beta3 = ** NOTA BENE: ** the use of modules that are marked experimental, by being part of the sub module 'wicket-experimental', are really that: experimental. These modules can change, disappear or blow up your computer without notice and you really use/depend on them at your own risk. Wicket Native Websockets A new **experimental** module has been added to Wicket 6 - Wicket Native WebSocket. This module adds support for using HTML5 WebSockets as you may use Ajax in your Wicket applications. All you have to do is to add a WebSocketBehavior to your page and from there on you can receive messages from the clients and push messages back to them. At https://cwiki.apache.org/confluence/x/0vSoAQ you may find the documentation and a link to a demo application. If something is not clear feel free to ask your question in the mailing lists and we will improve the documentation. Wicket Bootstrap The **experimental** modules now contain a new module for integration with Twitter's Bootstrap. Currently this module only provides a central way of using the Bootstrap resources. In the future we will provide proper components and behaviors for the Bootstrap concepts. To use this new **experimental** module, add this to your pom: org.apache.wicket wicket-bootstrap 0.1 To add Bootstrap support to your pages, add this in the `renderHead` method: @Override public void renderHead(IHeaderResponse response) { super.renderHead(response); Bootstrap.renderHead(response); } This will render a dependency to the Twitter bootstrap CSS and JS files, including the required dependency to JQuery. New Wicket Examples --- We have started an effort to revamp the tried and tested Wicket Examples and bring them into 2012. The new examples are located in the **experimental** module. It is currently a copy of Twitter Bootstrap's design but with Wicket specific filling. You can test the examples by running the wicket-examples-jar/src/test/java/Start.java class in the default package. The examples will feature a component reference with typical use cases, full examples such as Hello, World, and descriptions of the code in play. Wicket Atmosphere - Wicket Atmosphere in the experimental modules has seen an upgrade of the Atmosphere dependency to 1.0.0-beta3. This has caused an incompatibility with Jetty 7.6.3 (used with Wicket and the examples). To mitigate this, you need to override either: - the dependency on Jetty to 8.1.3 or newer, or - the dependency on Atmosphere to 0.9.5 (0.9.6 and 0.9.7 are broken as well) See https://issues.apache.org/jira/browse/WICKET-4656 for more information regarding this issue. This release * Check the roadmap with a list of the major goals: https://cwiki.apache.org/WICKET/wicket-60-roadmap.html * And the migration guide with all major and some minor changes between 1.5.x and 6.x series: http://s.apache.org/wicket-6.0-migration * The Jira changelog of all closed ticket at Jira: http://s.apache.org/wicket-6.0.0-beta3-changelog To use it in Maven: org.apache.wicket wicket-core 6.0.0-beta3 If you don’t use a dependencies management build tool then you can download the full distribution (including source) and build from source yourself. Have fun, The Wicket team! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Validating form components in a refreshing view
Hi Tobi ; I cant see any Validation code.. Josh. On Tue, Jul 17, 2012 at 12:01 PM, Tobias Knierim < tobias.knie...@googlemail.com> wrote: > Hi Josh, > > I just created a little example of how my application is working: > I want to compare value2 from Entry1 with value1 from Entry2 and so on. > > Any ideas? > > > Form form = new Form("form"); > add(form); > > RefreshingView refreshingView = new > RefreshingView("list", values) { > > @Override > protected Iterator> getItemModels() { > List entryList = > values.getObject().getEntryList(); > > ModelIteratorAdapter mia = new > ModelIteratorAdapter(entryList.iterator()) { > > @Override > protected IModel > model(Entry object) { > return new > CompoundPropertyModel(object); > } > }; > return mia; > } > > @Override > protected void populateItem(Item item) { > IModel model = item.getModel(); > > item.add(new TextField("textOne", > new > PropertyModel(model, "value1"))); > item.add(new TextField("textTwo", > new > PropertyModel(model, "value2"))); > } > > }; > > form.add(refreshingView); > > Tobi > > > 2012/7/17 Josh Kamau : > > Tobi ; > > > > May be you can paste some code to show how you are constructing the > > forms... > > > > I believe if you just add the validators to the components and then > submit > > the forms, it just works.. > > > > Josh. > > > > On Tue, Jul 17, 2012 at 10:22 AM, Tobias Knierim < > > tobias.knie...@googlemail.com> wrote: > > > >> Hi Josh, > >> > >> The whole view is wrapped in one form. > >> > >> Greetings > >> Tobi > >> > >> Am 17.07.2012 um 09:04 schrieb Josh Kamau : > >> > >> > Hi ; > >> > > >> > Is the whole listview wrapped in 1 form or there is a form for each > row? > >> > > >> > Josh. > >> > > >> > On Tue, Jul 17, 2012 at 10:02 AM, Tobias Knierim < > >> > tobias.knie...@googlemail.com> wrote: > >> > > >> >> Hi there, > >> >> I'm new to wicket and have a problem I can't find out for myself. > >> >> Maybe some of you can help me out with this. > >> >> > >> >> I have a refreshingview with input fields each row. I can add new > rows > >> >> on click of a button, but when I submit the form, I want to validate > 2 > >> >> input fields from different rows. Everything I tried so far hasn't > >> >> worked out, because I was only able to validate values from one row. > >> >> > >> >> Is it even possible to do something like this? > >> >> > >> >> > >> >> Greetings > >> >> Tobi > >> >> > >> >> - > >> >> 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: Validating form components in a refreshing view
Hi Josh, you're right, I haven't put any in this example because I am really not sure how I should accomplish this. If I choose a FormValidator with the FormComponents textOne and textTwo, I can just compare the values of one row. I will extend my example later. Tobi 2012/7/17 Josh Kamau : > Hi Tobi ; > > I cant see any Validation code.. > > Josh. > > On Tue, Jul 17, 2012 at 12:01 PM, Tobias Knierim < > tobias.knie...@googlemail.com> wrote: > >> Hi Josh, >> >> I just created a little example of how my application is working: >> I want to compare value2 from Entry1 with value1 from Entry2 and so on. >> >> Any ideas? >> >> >> Form form = new Form("form"); >> add(form); >> >> RefreshingView refreshingView = new >> RefreshingView("list", values) { >> >> @Override >> protected Iterator> getItemModels() { >> List entryList = >> values.getObject().getEntryList(); >> >> ModelIteratorAdapter mia = new >> ModelIteratorAdapter(entryList.iterator()) { >> >> @Override >> protected IModel >> model(Entry object) { >> return new >> CompoundPropertyModel(object); >> } >> }; >> return mia; >> } >> >> @Override >> protected void populateItem(Item item) { >> IModel model = item.getModel(); >> >> item.add(new TextField("textOne", >> new >> PropertyModel(model, "value1"))); >> item.add(new TextField("textTwo", >> new >> PropertyModel(model, "value2"))); >> } >> >> }; >> >> form.add(refreshingView); >> >> Tobi >> >> >> 2012/7/17 Josh Kamau : >> > Tobi ; >> > >> > May be you can paste some code to show how you are constructing the >> > forms... >> > >> > I believe if you just add the validators to the components and then >> submit >> > the forms, it just works.. >> > >> > Josh. >> > >> > On Tue, Jul 17, 2012 at 10:22 AM, Tobias Knierim < >> > tobias.knie...@googlemail.com> wrote: >> > >> >> Hi Josh, >> >> >> >> The whole view is wrapped in one form. >> >> >> >> Greetings >> >> Tobi >> >> >> >> Am 17.07.2012 um 09:04 schrieb Josh Kamau : >> >> >> >> > Hi ; >> >> > >> >> > Is the whole listview wrapped in 1 form or there is a form for each >> row? >> >> > >> >> > Josh. >> >> > >> >> > On Tue, Jul 17, 2012 at 10:02 AM, Tobias Knierim < >> >> > tobias.knie...@googlemail.com> wrote: >> >> > >> >> >> Hi there, >> >> >> I'm new to wicket and have a problem I can't find out for myself. >> >> >> Maybe some of you can help me out with this. >> >> >> >> >> >> I have a refreshingview with input fields each row. I can add new >> rows >> >> >> on click of a button, but when I submit the form, I want to validate >> 2 >> >> >> input fields from different rows. Everything I tried so far hasn't >> >> >> worked out, because I was only able to validate values from one row. >> >> >> >> >> >> Is it even possible to do something like this? >> >> >> >> >> >> >> >> >> Greetings >> >> >> Tobi >> >> >> >> >> >> - >> >> >> 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 >> >> - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Datatable with filter: string inpput for numeric columns
I have a datatable with a filter. It works fine, but.. I have numeric columns. I want the user to enter a String instead of a number. This is because we add more functions to the input so the user can enter more filter commands like >10&<20 Now this is not possible in the filter. Who can help Example Customer number Name >100&<1010 __ 1001 Smith 1008 Wesson -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Datatable-with-filter-string-inpput-for-numeric-columns-tp4650566.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: Determine session size for Wicket 1.5
Get a heapdump, use yourkit/visualvm. On Mon, Jul 16, 2012 at 11:14 AM, Ian Marshall wrote: > I don't think that I am getting the session size in the right place. Despite > my session sizes being logged as very small at ~1.7kB using the Google App > Engine (GAE) web development server, in GAE production I am getting session > sizes approaching 1MB (and attempting to breach this GAE-imposed limit of > 1MB too). > > I shall have to try and find somewhere else to get a meaningful session > size. > > > > Ian Marshall wrote >> >> Thanks Martin, >> >> I could not find onDetach() but found detach() so I have done this in my >> WebSession subclass: >> >> @Override >> public void detach() >> { >> long loSize = getSizeInBytes(); >> m_logger.log(Level.FINE, String.format("Session size = %,dB.", >> loSize)); >> super.detach(); >> } >> >> This seems to be fine (my sessions seem very small at ~1.7kB - I must be >> doing something wrong) except that this method can be called several times >> as a result of one request. >> >> Thanks again, >> >> Ian >> >> >> >> Martin Grigorov-4 wrote >>> >>> Override Session#onDetach() and do it before calling super.onDetach(). >>> >>> On Fri, Jul 13, 2012 at 2:01 PM, Ian Marshall>>> wrote: Hello, Is there a good way to discover my serialised or about-to-be-serialised session size without adding the debug bar to my page? I currently use @Override protected void onAfterRender() { super.onAfterRender(); CloudSession ssnSession = (CloudSession)getSession(); long loSize = ssnSession.getSizeInBytes(); m_logger.log(Level.FINE, String.format("Session size = %,dB.", loSize)); } in my WebPage subclass, but I suspect that this is the wrong place to examine the session size. My software environment is: Web framework: Wicket 1.5.7 Web server system: Google App Engine for Java version 1.7.0 Java: 1.6.0_33; Java HotSpot(TM) Client VM 20.8-b03 Operating system: Microsoft Windows XP Home Edition version 2002 SP3 (version 5.1 running on x86; Cp1252; en_GB) Ian Marshall >> > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Determine-session-size-for-Wicket-1-5-tp4650050p4650543.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: Determine session size for Wicket 1.5
Thanks for the tip, Jochen. I'm already doing that now, using Oracle's Java VisualVM Jochen Mader wrote > > Get a heapdump, use yourkit/visualvm. > > On Mon, Jul 16, 2012 at 11:14 AM, Ian Marshall> wrote: >> I don't think that I am getting the session size in the right place. >> Despite >> my session sizes being logged as very small at ~1.7kB using the Google >> App >> Engine (GAE) web development server, in GAE production I am getting >> session >> sizes approaching 1MB (and attempting to breach this GAE-imposed limit of >> 1MB too). >> >> I shall have to try and find somewhere else to get a meaningful session >> size. >> >> >> >> Ian Marshall wrote >>> >>> Thanks Martin, >>> >>> I could not find onDetach() but found detach() so I have done this in my >>> WebSession subclass: >>> >>> @Override >>> public void detach() >>> { >>> long loSize = getSizeInBytes(); >>> m_logger.log(Level.FINE, String.format("Session size = %,dB.", >>> loSize)); >>> super.detach(); >>> } >>> >>> This seems to be fine (my sessions seem very small at ~1.7kB - I must be >>> doing something wrong) except that this method can be called several >>> times >>> as a result of one request. >>> >>> Thanks again, >>> >>> Ian >>> >>> >>> >>> Martin Grigorov-4 wrote Override Session#onDetach() and do it before calling super.onDetach(). On Fri, Jul 13, 2012 at 2:01 PM, Ian Marshall wrote: > Hello, > > Is there a good way to discover my serialised or > about-to-be-serialised > session size without adding the debug bar to my page? > > I currently use > > @Override > protected void onAfterRender() > { > super.onAfterRender(); > > CloudSession ssnSession = (CloudSession)getSession(); > long loSize = ssnSession.getSizeInBytes(); > m_logger.log(Level.FINE, String.format("Session size = %,dB.", > loSize)); > } > > in my WebPage subclass, but I suspect that this is the wrong place to > examine the session size. > > My software environment is: > > Web framework: Wicket 1.5.7 > Web server system: Google App Engine for Java version 1.7.0 > Java: 1.6.0_33; Java HotSpot(TM) Client VM 20.8-b03 > Operating system: Microsoft Windows XP Home Edition version 2002 > SP3 > (version 5.1 running on x86; Cp1252; en_GB) > > > Ian Marshall >>> >> >> -- >> View this message in context: >> http://apache-wicket.1842946.n4.nabble.com/Determine-session-size-for-Wicket-1-5-tp4650050p4650543.html >> Sent from the Users forum mailing list archive at Nabble.com. >> >> - >> To unsubscribe, e-mail: users-unsubscribe@.apache >> For additional commands, e-mail: users-help@.apache >> > > - > To unsubscribe, e-mail: users-unsubscribe@.apache > For additional commands, e-mail: users-help@.apache -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Determine-session-size-for-Wicket-1-5-tp4650050p4650569.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: Understanding Wicket redirect behavior
Anybody? On Sat, Jul 14, 2012 at 5:24 PM, Alec Swan wrote: > Is there a way in 1.4.x to avoid a 302 redirect to /lrm/ms/oid/123.0 > when the user opens /lrm/ms/oid/123? > > Thanks, > > Alec > > On Sat, Jul 14, 2012 at 5:09 PM, Alec Swan wrote: >> Michael, >> >> I integrated DisabledJSessionIDinUrlFilter code that you sent me and I >> still get a 302 redirect. The filter behaves the same as >> COOKIE Tomcat 7 configuration. >> >> In other words /lrm/ms/oid/123 is still redirected with 302 code to >> /lrm/ms/oid/../../ms/oid/123.0. Note that I no longer have jsessionid >> at the end of the URL. >> >> I think the core problem is that my page is versionable and therefore >> Wicket created the first version of the page and does a 302 redirect >> to it. >> >> Still struggling with this. >> >> Alec >> >> >> On Sat, Jul 14, 2012 at 3:48 PM, Michael Mosmann wrote: >>> Hi Alec, >>> >>> Ok.. so far for now: >>> - with wicket 1.4 removing the jessionID from URL should do the trick. >>> And AFAIK wicket 1.4 should not do any redirect after this. >>> - with wicket 1.5 the jsessionID is gone, BUT wicket 1.5 will do some >>> redirect from path/yourPage to path/yourPage?0 (0 or other - wicket >>> page version) >>> >>> Michael >>> >>> Am Samstag, den 14.07.2012, 14:47 -0600 schrieb Alec Swan: Thanks Michael. I read the first link before and the only thing that I didn't do (and probable cannot do) is make my pages stateless. As far as the second link to DisabledJSessionIDinUrlFilter.java, doesn't it just strip off JSESSIONID from the URL? Is there something that I missed? Thanks, Alec On Sat, Jul 14, 2012 at 2:38 PM, Michael Mosmann wrote: > Maybe this will help > > https://cwiki.apache.org/WICKET/seo-search-engine-optimization.html > > Or try this one: > > https://github.com/michaelmosmann/wicket-praxis/blob/master/de.wicketpraxis--pom/webapp/src/main/java/de/wicketpraxis/web/thema/howto/servletfilter/DisabledJSessionIDinUrlFilter.java > > Michael mosmann > > -- > Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail > gesendet. > > > > Alec Swan schrieb: > > Thanks Josh, I upgraded to Tomcat7 and was able to disable cookies as > you suggested. It worked! This, however does not help me change 302 > redirect to 200. > > Is there any way I can make /lrm/ms/oid/123 return 200 just like > /lrm/network as explained in my original post? > > Thanks, > > Alec > > > On Sat, Jul 14, 2012 at 12:36 PM, Josh Kamau > wrote: >> I read somewhere that : >> >> When its first time you are accessing a page, tomcat doesnt know if >> cookies >> are supported.. so to be safe, it will embed the session id in the url. >> IF >> you then access another page, this time round tomcat knows what kind of >> browser its dealing with ... and if cookies are supported, it wont embed >> the session id in the url but will put it in a cookie.. >> >> Now to tell tomcat to always use the cookies , you add >> >> >> COOKIE >> >> >> >> In your web.xml file.. >> >> Cheers >> Josh >> >> On Sat, Jul 14, 2012 at 8:30 PM, Alec Swan wrote: >> >>> Hello, >>> >>> While working on my previous problem I found out that when I do a GET >>> to one of my bookmarkable pages, e.g. /lrm/ms/oid/123, I get a 302 >>> redirect to /lrm/ms/oid/../../ms/oid/123.0;jsessionid=xxx. However, >>> when I do a GET to /lrm/network I get a 200 response and jsessionid is >>> set as a cookie in the response. >>> >>> /lrm/network is explicitly mounted as mountBookmarkablePage in >>> Application.init(). We are using Tomcat 6.0 and Wicket 1.4.17. >>> >>> How can I make /lrm/ms/oid/123 return 200 just like /lrm/network? >>> Should we somehow mountBookmarkablePage each such page which we have >>> thousands of? Will upgrading to Wicket 1.5 help achieve this behavior? >>> >>> Thanks, >>> >>> Alec >>> >>>_ > >>> 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 >>> >>> >>> >>> - >>> To unsubscribe, e-mail: us
RE: Validating form components in a refreshing view
For example of how you could validate a form given multiple form fields take a look at how EqualInputValidator is implemented. You would have to keep references to the form fields that are related and return them as an array via IFormValidator. getDependentFormComponents() of your own IFormValidator implementation. Then you can add as many of those you want to your form. Wicket form processing: --- -- - -- | Start | -> | required | -> | convert | -> | validate | -> | push | -> | onSubmit() | | || checks || input || input || input || | --- -- - -- | || | fail fail fail fail --- | || || onError() | - - - - - - - - - - - - - - - - - - - - - - - - - - -> | | --- I recommend reading "Wicket in Action" (http://manning.com/dashorst/) or any other books listed on Wicket's website (http://wicket.apache.org/learn/books/). ~ Thank you, Paul Bors | Software Engineer | Knoa Software | 5 Union Square West, New York , NY 10003 | O: 212-807-9608 | www.knoa.com -Original Message- From: Tobias Knierim [mailto:tobias.knie...@googlemail.com] Sent: Tuesday, July 17, 2012 6:04 AM To: users@wicket.apache.org Subject: Re: Validating form components in a refreshing view Hi Josh, you're right, I haven't put any in this example because I am really not sure how I should accomplish this. If I choose a FormValidator with the FormComponents textOne and textTwo, I can just compare the values of one row. I will extend my example later. Tobi 2012/7/17 Josh Kamau : > Hi Tobi ; > > I cant see any Validation code.. > > Josh. > > On Tue, Jul 17, 2012 at 12:01 PM, Tobias Knierim < > tobias.knie...@googlemail.com> wrote: > >> Hi Josh, >> >> I just created a little example of how my application is working: >> I want to compare value2 from Entry1 with value1 from Entry2 and so on. >> >> Any ideas? >> >> >> Form form = new Form("form"); >> add(form); >> >> RefreshingView refreshingView = new >> RefreshingView("list", values) { >> >> @Override >> protected Iterator> getItemModels() { >> List entryList = >> values.getObject().getEntryList(); >> >> ModelIteratorAdapter mia = new >> ModelIteratorAdapter(entryList.iterator()) { >> >> @Override >> protected IModel >> model(Entry object) { >> return new >> CompoundPropertyModel(object); >> } >> }; >> return mia; >> } >> >> @Override >> protected void populateItem(Item item) { >> IModel model = >> item.getModel(); >> >> item.add(new >> TextField("textOne", new PropertyModel(model, >> "value1"))); >> item.add(new >> TextField("textTwo", new PropertyModel(model, >> "value2"))); >> } >> >> }; >> >> form.add(refreshingView); >> >> Tobi >> >> >> 2012/7/17 Josh Kamau : >> > Tobi ; >> > >> > May be you can paste some code to show how you are constructing the >> > forms... >> > >> > I believe if you just add the validators to the components and then >> submit >> > the forms, it just works.. >> > >> > Josh. >> > >> > On Tue, Jul 17, 2012 at 10:22 AM, Tobias Knierim < >> > tobias.knie...@googlemail.com> wrote: >> > >> >> Hi Josh, >> >> >> >> The whole view is wrapped in one form. >> >> >> >> Greetings >> >> Tobi >> >> >> >> Am 17.07.2012 um 09:04 schrieb Josh Kamau : >> >> >> >> > Hi ; >> >> > >> >> > Is the whole listview wrapped in 1 form or there is a form for >> >> > each >> row? >> >> > >> >> > Josh. >> >> > >> >> > On Tue, Jul 17, 2012 at 10:02 AM, Tobias Knierim < >> >> > tobias.knie...@googlemail.com> wrote: >> >> > >> >> >> Hi there, >> >> >> I'm new to wicket and have a problem I can't find out for myself. >> >> >> Maybe some of you can help me out with this. >> >> >> >> >> >> I have a refreshingview with input fields each row. I can add >> >> >> new >> rows >> >> >> on click of a button, but when I submit the form, I want to >> >> >> validate >> 2 >> >> >> input fields from different rows. Everything I tried so far >> >> >> hasn't worked out, be
Re: Wicket examples in new version
Had the same Question. Look at FormPage.java, FormPage.html and FormPage$ActionPanel.html in the wicket examples. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-examples-in-new-version-tp3729204p4650570.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
Next database key pre-filled in form and associated with PropertyModel returns null
G'day Short form: how do I pre-fill a form field with the dynamic value of the next free database key Long form: I'd like to pre-fill a form field with the value of the next free database key. I can do this by associating the form input field with a static model of a string value and replacing the field in the form each time the next key value changes. Works, but hardly elegant. So I've associated the input field with a (dynamic) property model. Because the next key value isn't a database field I've created a new class (called State) with a field for the next free database key. The property model I've associated with the form field points to that attribute of State. As each new database row is created I manually update the value of the next free key in State. This value then finds its way into the form when it is next displayed. So far so good. Each time the form is displayed I can see the correct next free key value pre-filled into the form as expected. But when the form is submitted and I do a getModelObject() on the form the gotten object has null in the field that should contain the next free database key. All the other fields are correctly received from the form. (This is true more generally - in more complex forms all the form fields that are not associated with State are correctly received from the form. All those that are associated with State are null.) What is weird is that if I do: Account account = getModelObject(); // returns null in field accountNumber which is associated with State account.setAccountnumber(Integer.parseInt(accountNumber.getInput())); // Gets and sets the pre-filled value then I get the desired result i.e. field accountNumber of account is set to the pre-filled value. So there is no doubt that form field has the desired value - I can see it, and getInput() gets it. But getModelObject() (which I would be expecting to call getInput() under the covers) doesn't get the pre-filled value. I suspect this is a question of understanding about models in general. (I've looked at whether I should add my PropertyModel in some way to the LoadableDetachableModel that is associated with the form but the water got rather deep rather quickly.) Any enlightenment appreciated. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Next-database-key-pre-filled-in-form-and-associated-with-PropertyModel-returns-null-tp4650518.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: Next database key pre-filled in form and associated with PropertyModel returns null
How do you determine which next key is available? If two users open the form at the same time will they see the same key? If so, then you need to handle errors from concurrent form submissions with the same key. Which means for one of these concurrent requests you will have to issue a different key and show it to the user after the form was submitted. So, why not show the key after form submission all the time? On Sat, Jul 14, 2012 at 1:03 AM, Ian wrote: > G'day > > Short form: how do I pre-fill a form field with the dynamic value of the > next free database key > > Long form: > > I'd like to pre-fill a form field with the value of the next free database > key. I can do this by associating the form input field with a static model > of a string value and replacing the field in the form each time the next key > value changes. Works, but hardly elegant. > > So I've associated the input field with a (dynamic) property model. Because > the next key value isn't a database field I've created a new class (called > State) with a field for the next free database key. The property model I've > associated with the form field points to that attribute of State. As each > new database row is created I manually update the value of the next free key > in State. This value then finds its way into the form when it is next > displayed. So far so good. Each time the form is displayed I can see the > correct next free key value pre-filled into the form as expected. > > But when the form is submitted and I do a getModelObject() on the form the > gotten object has null in the field that should contain the next free > database key. All the other fields are correctly received from the form. > (This is true more generally - in more complex forms all the form fields > that are not associated with State are correctly received from the form. All > those that are associated with State are null.) > > What is weird is that if I do: > > Account account = getModelObject(); // returns null in field accountNumber > which is associated with State > account.setAccountnumber(Integer.parseInt(accountNumber.getInput())); // > Gets and sets the pre-filled value > > then I get the desired result i.e. field accountNumber of account is set to > the pre-filled value. > > So there is no doubt that form field has the desired value - I can see it, > and getInput() gets it. But getModelObject() (which I would be expecting to > call getInput() under the covers) doesn't get the pre-filled value. > > I suspect this is a question of understanding about models in general. (I've > looked at whether I should add my PropertyModel in some way to the > LoadableDetachableModel that is associated with the form but the water got > rather deep rather quickly.) > > Any enlightenment appreciated. > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Next-database-key-pre-filled-in-form-and-associated-with-PropertyModel-returns-null-tp4650518.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: Understanding Wicket redirect behavior
I am still working on this.. but it takes time. -- Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet. Alec Swan schrieb: Anybody? On Sat, Jul 14, 2012 at 5:24 PM, Alec Swan wrote: > Is there a way in 1.4.x to avoid a 302 redirect to /lrm/ms/oid/123.0 > when the user opens /lrm/ms/oid/123? > > Thanks, > > Alec > > On Sat, Jul 14, 2012 at 5:09 PM, Alec Swan wrote: >> Michael, >> >> I integrated DisabledJSessionIDinUrlFilter code that you sent me and I >> still get a 302 redirect. The filter behaves the same as >> COOKIE Tomcat 7 configuration. >> >> In other words /lrm/ms/oid/123 is still redirected with 302 code to >> /lrm/ms/oid/../../ms/oid/123.0. Note that I no longer have jsessionid >> at the end of the URL. >> >> I think the core problem is that my page is versionable and therefore >> Wicket created the first version of the page and does a 302 redirect >> to it. >> >> Still struggling with this. >> >> Alec >> >> >> On Sat, Jul 14, 2012 at 3:48 PM, Michael Mosmann wrote: >>> Hi Alec, >>> >>> Ok.. so far for now: >>> - with wicket 1.4 removing the jessionID from URL should do the trick. >>> And AFAIK wicket 1.4 should not do any redirect after this. >>> - with wicket 1.5 the jsessionID is gone, BUT wicket 1.5 will do some >>> redirect from path/yourPage to path/yourPage?0 (0 or other - wicket >>> page version) >>> >>> Michael >>> >>> Am Samstag, den 14.07.2012, 14:47 -0600 schrieb Alec Swan: Thanks Michael. I read the first link before and the only thing that I didn't do (and probable cannot do) is make my pages stateless. As far as the second link to DisabledJSessionIDinUrlFilter.java, doesn't it just strip off JSESSIONID from the URL? Is there something that I missed? Thanks, Alec On Sat, Jul 14, 2012 at 2:38 PM, Michael Mosmann wrote: > Maybe this will help > > https://cwiki.apache.org/WICKET/seo-search-engine-optimization.html > > Or try this one: > > https://github.com/michaelmosmann/wicket-praxis/blob/master/de.wicketpraxis--pom/webapp/src/main/java/de/wicketpraxis/web/thema/howto/servletfilter/DisabledJSessionIDinUrlFilter.java > > Michael mosmann > > -- > Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail > gesendet. > > > > Alec Swan schrieb: > > Thanks Josh, I upgraded to Tomcat7 and was able to disable cookies as > you suggested. It worked! This, however does not help me change 302 > redirect to 200. > > Is there any way I can make /lrm/ms/oid/123 return 200 just like > /lrm/network as explained in my original post? > > Thanks, > > Alec > > > On Sat, Jul 14, 2012 at 12:36 PM, Josh Kamau > wrote: >> I read somewhere that : >> >> When its first time you are accessing a page, tomcat doesnt know if >> cookies >> are supported.. so to be safe, it will embed the session id in the url. >> IF >> you then access another page, this time round tomcat knows what kind of >> browser its dealing with ... and if cookies are supported, it wont embed >> the session id in the url but will put it in a cookie.. >> >> Now to tell tomcat to always use the cookies , you add >> >> >> COOKIE >> >> >> >> In your web.xml file.. >> >> Cheers >> Josh >> >> On Sat, Jul 14, 2012 at 8:30 PM, Alec Swan wrote: >> >>> Hello, >>> >>> While working on my previous problem I found out that when I do a GET >>> to one of my bookmarkable pages, e.g. /lrm/ms/oid/123, I get a 302 >>> redirect to /lrm/ms/oid/../../ms/oid/123.0;jsessionid=xxx. However, >>> when I do a GET to /lrm/network I get a 200 response and jsessionid is >>> set as a cookie in the response.
Form Submission problem
Hi , I have inserted my custom filter in which i have specified url-pattern as /*, but now the form submission is not going just getting a blank page, Please advise how to handle this. I dont see any Exceptions on my logs too. Thanks, -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Form-Submission-problem-tp4650575.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: Next database key pre-filled in form and associated with PropertyModel returns null
On Sat, Jul 14, 2012 at 3:03 AM, Ian wrote: > G'day > > Short form: how do I pre-fill a form field with the dynamic value of the > next free database key > > Is your customer demanding that the database ids end up without any gaps? If so, try to work hard to dissuade your customer. Database ids should have no other business meeting. They should be opaque. One good way to distinguish between a object that has not yet been persisted and one that has is whether its id variable is null or not. So, suppose you have a Form. In your onSubmit method, you call personService.create(getModelObject()), where personService calls DAOs, or maybe is a DAO. It modifies the Person object in place, setting the id when it is done. It then redirects the user to the appropriate page. If there is a constraint violation or other database problem, the object should be unchanged and the system should remain on the form page. You can reuse the form page if you want to edit an existing person. You just don't give the user any way to edit the id, and you call an update method instead. Respectfully, Eric Jablow
Re: Form Submission problem
Hi, can you post the code of your custom filter? Hi , I have inserted my custom filter in which i have specified url-pattern as /*, but now the form submission is not going just getting a blank page, Please advise how to handle this. I dont see any Exceptions on my logs too. Thanks, -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Form-Submission-problem-tp4650575.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
Update JavaDoc for AbstractChoice#setType(java.lang.Class)
How should we as Wicket users request updates to JavaDocs as we come across them? AbstractChoice.setType throws an UnsupportedOperationException but that's not reflected in its JavaDoc at: http://ci.apache.org/projects/wicket/apidocs/1.5.x/org/apache/wicket/markup/html/form/AbstractChoice.html#setType(java.lang.Class) This is not mentioned in the migration guide. Perhaps a note should be added next to the one about AbstractSingleSelectChoice: https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-%2528RC6%2529AbstractSingleSelectChoiceusesemptyStringasvaluefordefaultchoice ~ Thank you, Paul Bors - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
wicket ajax question
I have a panel with some content. It has an AjaxLink that I use to refresh the panel. In the onclick handler I refresh the content and target.add(component..) .. that all works great... but I want to do it another way. I add an AbstractAjaxBehavior to the panel, because I want to make ajax calls to it from the client. I override renderHead() to put some JS in the client header that I can use later to call back to my panel - it is a JS object with a function that sets up a $.ajax() call using the callbackURL of my behavior... I override onRequest() to catch the incoming ajax call... sure enough it gets hit in the debugger... I do my internal refresh of my panel's model ... Now I need to get it to re-render.. the AjaxLink did this via target.add(..component), so I figured I would get myself an AjaxRequestTarget and do the same: WebApplication app = (WebApplication)getComponent().getApplication(); AjaxRequestTarget target = app.newAjaxRequestTarget(getComponent().getPage()); ... then target.add(..component..) as before... however this time the panel doesn't appear to redraw... what am I missing? TIA -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicket-ajax-question-tp4650579.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
Preventing users from re-submitting wizards
Hi all, We have a wizard workflow for our users that collects various inputs, and when submitted, persists entities and kicks off some processing. After the wizard is submitted, the user should not be able to navigate back and resubmit the wizard. The obvious solution of maintaining a boolean "isSubmitted" state within the page does not work, because during wizard navigation many page IDs were created due to model and hierarchy changes. The isSubmitted=true is seen by the first history entry, but page instances further back have isSubmitted=false. Another solution is setVersioned(false), but we like the back button to work while wizard is active. It seems like we need to maintain wizard state at a higher scope such as the session, keyed uniquely by some wizard instance identifier (maybe a UUID). Ensuring that this set of submitted (or in-progress) wizards remains bounded seems challenging, though probably not a practical concern. Do you have a more clever solution to this problem? Regards, Dan
Re: Next database key pre-filled in form and associated with PropertyModel returns null
G'day In part the question was based on a misunderstanding which I have now overcome. I thought that all the columns of the database table had to be present in the form as form fields. But that is not the case. So any column whose value I know ahead of time I don't present on the form - I just give them values in the code after the user submits the form. I also came to the same conclusion about the database keys. So that reduces the question to form fields that I want to pre-fill with a (context-dependent) default value but whose value I allow the user to change. I can pre-fill the fields using a Property model as described in the initial post, but such values are null after the GetModelObject(). Is this a misunderstanding about models - that the GetModelObject won't get the values of form fields that are linked with a model other than the model the form is linked with. Seems reasonable, except that if the pre-filled fields are linked with a static model instead of the (dynamic) PropertyModel the form values are retrieved correctly by GetModelObject(). Ian Blavins On 18/07/2012, at 4:22 AM, Eric Jablow [via Apache Wicket] wrote: > On Sat, Jul 14, 2012 at 3:03 AM, Ian <[hidden email]> wrote: > > > G'day > > > > Short form: how do I pre-fill a form field with the dynamic value of the > > next free database key > > > > Is your customer demanding that the database ids end up without > any gaps? If so, try to work hard to dissuade your customer. Database > ids should have no other business meeting. They should be opaque. > One good way to distinguish between a object that has not yet been > persisted and one that has is whether its id variable is null or not. > > So, suppose you have a Form. In your onSubmit method, you > call personService.create(getModelObject()), where personService > calls DAOs, or maybe is a DAO. It modifies the Person object in place, > setting the id when it is done. It then redirects the user to the > appropriate > page. If there is a constraint violation or other database problem, > the object should be unchanged and the system should remain on > the form page. > > You can reuse the form page if you want to edit an existing person. You > just don't give the user any way to edit the id, and you call an update > method instead. > > Respectfully, > Eric Jablow > > > If you reply to this email, your message will be added to the discussion > below: > http://apache-wicket.1842946.n4.nabble.com/Next-database-key-pre-filled-in-form-and-associated-with-PropertyModel-returns-null-tp4650518p4650576.html > To unsubscribe from Next database key pre-filled in form and associated with > PropertyModel returns null, click here. > NAML -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Next-database-key-pre-filled-in-form-and-associated-with-PropertyModel-returns-null-tp4650518p4650581.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: Next database key pre-filled in form and associated with PropertyModel returns null
G'day In part the question was based on a misunderstanding which I have now overcome. I thought that all the columns of the database table had to be present in the form as form fields. This meant that I had to pre-fill values for the key fields. This indeed has the difficulties that you raise. But it is not the case that all the columns need to be in the form. So I no longer show the key fields but provide values for their columns after I retrieve the form with GetModelObject(). That side-steps the difficulties you mention. And, yes, I now need in some cases to show the user the key value that was generated. I've done that crudely with a form that becomes visible after the database row has been successfully created. But I will replace that with a reusable model window in due course. (Unless Wicket 5 has a simpler dialog box feature that I haven't yet discovered. I don't want to do the dialog box in Javascript). But that still leaves the question of why the pre-filled values weren't retrieved by the GetModelObject(). Their values are associated with a model other than the model that is associated with form - is that the reason ? Seems reasonable, except that if the pre-filled form fields are associated with a static model (rather than the (dynamic) PropertyModel that I currently use) then the pre-filled values are correctly retrieved by GetModelObject(). Ian Blavins On 18/07/2012, at 1:42 AM, Alec Swan [via Apache Wicket] wrote: > How do you determine which next key is available? If two users open > the form at the same time will they see the same key? If so, then you > need to handle errors from concurrent form submissions with the same > key. Which means for one of these concurrent requests you will have to > issue a different key and show it to the user after the form was > submitted. So, why not show the key after form submission all the > time? > > On Sat, Jul 14, 2012 at 1:03 AM, Ian <[hidden email]> wrote: > > > G'day > > > > Short form: how do I pre-fill a form field with the dynamic value of the > > next free database key > > > > Long form: > > > > I'd like to pre-fill a form field with the value of the next free database > > key. I can do this by associating the form input field with a static model > > of a string value and replacing the field in the form each time the next > > key > > value changes. Works, but hardly elegant. > > > > So I've associated the input field with a (dynamic) property model. Because > > the next key value isn't a database field I've created a new class (called > > State) with a field for the next free database key. The property model I've > > associated with the form field points to that attribute of State. As each > > new database row is created I manually update the value of the next free > > key > > in State. This value then finds its way into the form when it is next > > displayed. So far so good. Each time the form is displayed I can see the > > correct next free key value pre-filled into the form as expected. > > > > But when the form is submitted and I do a getModelObject() on the form the > > gotten object has null in the field that should contain the next free > > database key. All the other fields are correctly received from the form. > > (This is true more generally - in more complex forms all the form fields > > that are not associated with State are correctly received from the form. > > All > > those that are associated with State are null.) > > > > What is weird is that if I do: > > > > Account account = getModelObject(); // returns null in field accountNumber > > which is associated with State > > account.setAccountnumber(Integer.parseInt(accountNumber.getInput())); // > > Gets and sets the pre-filled value > > > > then I get the desired result i.e. field accountNumber of account is set to > > the pre-filled value. > > > > So there is no doubt that form field has the desired value - I can see it, > > and getInput() gets it. But getModelObject() (which I would be expecting to > > call getInput() under the covers) doesn't get the pre-filled value. > > > > I suspect this is a question of understanding about models in general. > > (I've > > looked at whether I should add my PropertyModel in some way to the > > LoadableDetachableModel that is associated with the form but the water got > > rather deep rather quickly.) > > > > Any enlightenment appreciated. > > > > > > > > -- > > View this message in context: > > http://apache-wicket.1842946.n4.nabble.com/Next-database-key-pre-filled-in-form-and-associated-with-PropertyModel-returns-null-tp4650518.html > > Sent from the Users forum mailing list archive at Nabble.com. > > > > - > > To unsubscribe, e-mail: [hidden email] > > For additional commands, e-mail: [hidden email] > > > > - >
Re: wicket ajax question
the problem was that i wasn't passing the target back as the response.. found it better to reuse the wicket ajax stuff when it comes to updating wicket panels... -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/wicket-ajax-question-tp4650579p4650583.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