Hi Martijn, So the only solution is to move the inner forms to be no longer 'inner'?
Thanks J Jeremy2009 wrote: > > Hi Martijn, > > Thanks for your super-fast reply. > > According to the Wicket Ajax Debugger, it says "INFO: focus set on > userTagsCons144" - which is the 2nd inner form's text field. On clicking > 'enter', is the Ajax javascript able to check which form-related object > has the current focus and therefore decide which inner form to dispatch > the Ajax request to? > > If not, is there any kind of work-around? > > Would I get the same problem if the inner forms were not nested? > > Many thanks, > Jeremy > > > > Martijn Dashorst wrote: >> >> According to me this is a browser thing, nothing Wicket can do >> anything about (without registering which field has focus, and sending >> that with the form, detecting that the default submit was triggered by >> pressing enter, figuring out which form was actually meant, etc. >> >> Martijn >> >> On Wed, Jan 7, 2009 at 3:06 PM, Jeremy2009 <jscol...@gmail.com> wrote: >>> >>> Hi, >>> >>> I have searched theforums for a similar situation but can't seem to find >>> anything. >>> >>> I have a complicated panel that consists of an outer form that contains >>> 2 >>> inner forms: >>> >>> a) The outer form has an AjaxSubmitLink with an onSubmit() that gets >>> fired >>> as expected. >>> >>> b) Each inner form has its own AjaxSubmitLink that allows the user to >>> enter >>> specific text which then gets added to the panel. >>> >>> All 3 forms have unique wicket id's. >>> >>> My problem is that when the user presses 'enter' in either of the 2 >>> inner >>> forms, the onSubmit of the 1st inner form always fires! The wicket Ajax >>> Debugger confirms that the 2nd inner form has focus, but that the 1st >>> inner >>> form is the target of the submit request! I would expect that the 2nd >>> inner >>> form be the target. If i comment out the 1st inner form, then the 2nd >>> inner >>> form's onSubmit fires as expected. >>> >>> The inner forms are created by a subclass since all that changes is the >>> name >>> of the wicket components inside each form so no need to duplicate the >>> code. >>> Here's my code for the inner forms: >>> >>> i) JAVA: >>> final Form tagsForm = new Form("userTypedTags" + >>> tagType); >>> >>> AjaxSubmitLink link = new >>> AjaxSubmitLink("onReturnSubmitTags"+tagType, >>> tagsForm) { >>> private static final long serialVersionUID = 1L; >>> >>> @Override >>> public void onSubmit(AjaxRequestTarget target, >>> Form tagsForm) { >>> LOGGER.info("**** in AjaxSubmitLink's >>> onsubmit for tagType: " + >>> tagType); >>> addSelectedTag(selectedTags, >>> tagText.getModelObjectAsString()); >>> tagText.setModelObject(""); >>> target.addComponent(selectedContainer); >>> target.addComponent(tagsForm); >>> } >>> }; >>> tagsForm.add(link); >>> >>> tagsForm.setOutputMarkupId(true); >>> add(tagsForm); >>> >>> ii) HTML for one of the subclasses that requires a form to be created >>> for >>> 'Pros' text (the 2nd subclass creates a form for 'Cons' text): >>> >>> <wicket:extend> >>> <form wicket:id="userTypedTagsPros"> >>> <input type="text" wicket:id="userTagsPros" >>> class="text"/> >>> <input type="submit" wicket:id="onReturnSubmitTagsPros" >>> style="display: >>> none;"> >>> </form> >>> </wicket:extend> >>> >>> Have you seen anything similar? >>> >>> Many thanks for your time, >>> Jeremy >>> >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/Nested-inner-forms%2C-each-with-their-own-AjaxSubmitLink%2C-but-only-the-1st-onSubmit-ever-gets-called-tp21331944p21331944.html >>> Sent from the Wicket - User 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 >>> >>> >> >> >> >> -- >> Become a Wicket expert, learn from the best: http://wicketinaction.com >> Apache Wicket 1.3.4 is released >> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> >> > > -- View this message in context: http://www.nabble.com/Nested-inner-forms%2C-each-with-their-own-AjaxSubmitLink%2C-but-only-the-1st-onSubmit-ever-gets-called-tp21331944p21392404.html Sent from the Wicket - User 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