Re: Handling nested form submission on enter
Works perfect!!! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Handling-nested-form-submission-on-enter-tp4548831p4666742.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: Handling nested form submission on enter
Hi, already tried form setDefaultButton method (see JavaDoc)? I have a nested form that works as expected when it's submit button (an IndicatingAjaxButton) is pressed but not when the user presses the enter key when one of it's form fields is focused. Is it possible to capture this enter key press to trigger the nested form's submit instead? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Handling nested form submission on enter
On 04/11/2012 04:14 PM, Andrea Del Bene wrote: already tried form setDefaultButton method (see JavaDoc)? Thanks, I just did and the flow is the one desired, but for some reason the nested form field models are not updated with the field inputs when the submit buttons onSubmit() is called. Is there something obvious I might be missing? Manos - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Handling nested form submission on enter
Well, I couldn't say why it doesn't work. Can you post some code of your nested forms? Thanks, I just did and the flow is the one desired, but for some reason the nested form field models are not updated with the field inputs when the submit buttons onSubmit() is called. Is there something obvious I might be missing? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Handling nested form submission on enter
On 04/11/2012 05:39 PM, Andrea Del Bene wrote: Well, I couldn't say why it doesn't work. Can you post some code of your nested forms? Sort of found what the problem is but have no clue on how to solve it. Pressing enter in one of the nested forms submits the last nested form in the page. Each form is within a custom FormComponentPanel I made to implement a widget, but it seems the nested forms are mixed up if more than one of these are used in the same page. Each of these FormComponentPanels is an instance of my MultipleValuesTextField: http://code.google.com/p/calipso/source/browse/trunk/calipso-war/src/main/java/gr/abiss/calipso/wicket/components/formfields/MultipleValuesTextField.java Manos - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Handling nested form submission on enter
It's like if JavaScript can't tell apart a form from another. Can you check the HTML generated for your page and see if forms have an unique id? On 04/11/2012 05:39 PM, Andrea Del Bene wrote: Well, I couldn't say why it doesn't work. Can you post some code of your nested forms? Sort of found what the problem is but have no clue on how to solve it. Pressing enter in one of the nested forms submits the last nested form in the page. Each form is within a custom FormComponentPanel I made to implement a widget, but it seems the nested forms are mixed up if more than one of these are used in the same page. Each of these FormComponentPanels is an instance of my MultipleValuesTextField: http://code.google.com/p/calipso/source/browse/trunk/calipso-war/src/main/java/gr/abiss/calipso/wicket/components/formfields/MultipleValuesTextField.java Manos - 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: Handling nested form submission on enter
On 04/11/2012 07:53 PM, Andrea Del Bene wrote: It's like if JavaScript can't tell apart a form from another. Can you check the HTML generated for your page and see if forms have an unique id? Checked, the IDs are unique. I couldn't figure out what the actual problem is so, to bypass it, I just added this to intercept the enter key and explicitly use my nested form's submit: final TextFieldString newValueField = new TextFieldString(newValueField, new PropertyModel(newSubFieldValues, [ + index + ])){ @Override protected void onComponentTag(ComponentTag tag){ super.onComponentTag(tag); tag.put(onkeypress, if(event.keyCode == 13) {document.getElementById(' + addButton.getMarkupId() + ').click();return false;}); } }; Hope this helps someone else with nested forms and the enter key. Manos - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org