RE: Form model update with ajax using AutoCompleteTextField
Hey I use this auto-complete field as a searcher to fill my list view I used the same class but I have a little problem with it ... I don't understand where to call method findChoice() so I added behavior to this search field like this: this.autocompleteSearchField.add( new AjaxFormComponentUpdatingBehavior("onchange") { private static final long serialVersionUID= 1L; @Override protected void onUpdate(AjaxRequestTarget theTarget) { Object obj = autocompleteSearchField.findChoice(); if(obj == null) { LOG.warn("Object is null!"); } if( !(obj instanceof Bean) ){ LOG.warn("Object is not subclass of a Bean! [{}]", obj.getClass()); return; } T bean = (T)obj; if(selections.contains(bean)) return; selections.add(bean); theTarget.addComponent(listWrapper); } } ); legend: - Bean is my data object - listWrapper is a wrapper that ListView in wrapped in mind this row: Object obj = autocompleteSearchField.findChoice(); how do you do it ? Kind regards Armando -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Form-model-update-with-ajax-using-AutoCompleteTextField-tp1872823p2313453.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
RE: Form model update with ajax using AutoCompleteTextField
or you can use this one- http://cwiki.apache.org/confluence/display/WICKET/Autocomplete+using+a+W icket+model First of all thanks for the answers! Have tried this one and it works fine! Just one problem: when there is a ModelObject set on first render the component I get an input like "id:1 number:12345 ...". How can I get the preset value get converted like the choices? -- View this message in context: http://www.nabble.com/Form-model-update-with-ajax-using-AutoCompleteTextField-tp19954381p20030992.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Form model update with ajax using AutoCompleteTextField
Meanwhile I figured out that the getModelObject() of the AutoCompleteTextField allways gives me null. Also if I selected one choice. While debugging I noticed it is a string. That's why I'm iterating through the choice objects to get back the object represented by the string in the autocomplete and then call setModelObject() with the one that matches. I override convertInput() for this but maybe this is the wrong place? -- View this message in context: http://www.nabble.com/Form-model-update-with-ajax-using-AutoCompleteTextField-tp19954381p19968868.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Form model update with ajax using AutoCompleteTextField
Still does not work! When I submit the form the object is null and the amount of is 0 even I selected an Object and type an valid amount. I'm not quite shure which components I have to add to the target for "onchange" Event. Right now I just added the form-component to the ajax target. Lutz Müller wrote: > > i also do it in convertInput(). So even if it should be the wrong place, > it > does work, and you are not alone with this solution ;) > > On Monday 13 October 2008 15:40:22 kerim bey wrote: >> While debugging I noticed it is a string. >> That's why I'm iterating through the choice objects to get back the >> object >> represented by the string in the autocomplete and then call >> setModelObject() with the one that matches. >> I override convertInput() for this but maybe this is the wrong place? >> >> Ryan Gravener-3 wrote: >> > You can search the archives for the answer to this one. Essentially >> > the model object for autocomplete is just a string. >> > >> > On 10/13/08, kerim bey <[EMAIL PROTECTED]> wrote: >> >> Hi! >> >> >> >> I have problems with using an AutoCompleteText field. >> >> Loading the choice Objects works fine, but when I select an entry the >> >> ModelObject (using a CompoundPropertyModel) of the Form is not >> updated. >> >> Calling setModelObject() doesn't seem to have any effect. >> >> >> >> Using a DropDownChoice the same way works. >> >> >> >> What is missing? >> >> -- >> >> View this message in context: >> >> >> http://www.nabble.com/Form-model-update-with-ajax-using-AutoCompleteText >> >>Field-tp19954381p19954381.html Sent from the Wicket - User mailing list >> >> archive at Nabble.com. >> >> >> >> >> >> - >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> > >> > -- >> > Ryan Gravener >> > http://twitter.com/ryangravener >> > >> > - >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Form-model-update-with-ajax-using-AutoCompleteTextField-tp19954381p19956343.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Form model update with ajax using AutoCompleteTextField
i also do it in convertInput(). So even if it should be the wrong place, it does work, and you are not alone with this solution ;) On Monday 13 October 2008 15:40:22 kerim bey wrote: > While debugging I noticed it is a string. > That's why I'm iterating through the choice objects to get back the object > represented by the string in the autocomplete and then call > setModelObject() with the one that matches. > I override convertInput() for this but maybe this is the wrong place? > > Ryan Gravener-3 wrote: > > You can search the archives for the answer to this one. Essentially > > the model object for autocomplete is just a string. > > > > On 10/13/08, kerim bey <[EMAIL PROTECTED]> wrote: > >> Hi! > >> > >> I have problems with using an AutoCompleteText field. > >> Loading the choice Objects works fine, but when I select an entry the > >> ModelObject (using a CompoundPropertyModel) of the Form is not updated. > >> Calling setModelObject() doesn't seem to have any effect. > >> > >> Using a DropDownChoice the same way works. > >> > >> What is missing? > >> -- > >> View this message in context: > >> http://www.nabble.com/Form-model-update-with-ajax-using-AutoCompleteText > >>Field-tp19954381p19954381.html Sent from the Wicket - User mailing list > >> archive at Nabble.com. > >> > >> > >> - > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > > > > -- > > Ryan Gravener > > http://twitter.com/ryangravener > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED]
Re: Form model update with ajax using AutoCompleteTextField
While debugging I noticed it is a string. That's why I'm iterating through the choice objects to get back the object represented by the string in the autocomplete and then call setModelObject() with the one that matches. I override convertInput() for this but maybe this is the wrong place? Ryan Gravener-3 wrote: > > You can search the archives for the answer to this one. Essentially > the model object for autocomplete is just a string. > On 10/13/08, kerim bey <[EMAIL PROTECTED]> wrote: >> >> Hi! >> >> I have problems with using an AutoCompleteText field. >> Loading the choice Objects works fine, but when I select an entry the >> ModelObject (using a CompoundPropertyModel) of the Form is not updated. >> Calling setModelObject() doesn't seem to have any effect. >> >> Using a DropDownChoice the same way works. >> >> What is missing? >> -- >> View this message in context: >> http://www.nabble.com/Form-model-update-with-ajax-using-AutoCompleteTextField-tp19954381p19954381.html >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > > -- > Ryan Gravener > http://twitter.com/ryangravener > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Form-model-update-with-ajax-using-AutoCompleteTextField-tp19954381p19955078.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Form model update with ajax using AutoCompleteTextField
or you can use this one- http://cwiki.apache.org/confluence/display/WICKET/Autocomplete+using+a+W icket+model -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ryan Gravener Sent: Monday, October 13, 2008 9:17 AM To: users@wicket.apache.org Subject: Re: Form model update with ajax using AutoCompleteTextField You can search the archives for the answer to this one. Essentially the model object for autocomplete is just a string. On 10/13/08, kerim bey <[EMAIL PROTECTED]> wrote: > > Hi! > > I have problems with using an AutoCompleteText field. > Loading the choice Objects works fine, but when I select an entry the > ModelObject (using a CompoundPropertyModel) of the Form is not updated. > Calling setModelObject() doesn't seem to have any effect. > > Using a DropDownChoice the same way works. > > What is missing? > -- > View this message in context: > http://www.nabble.com/Form-model-update-with-ajax-using-AutoCompleteTe > xtField-tp19954381p19954381.html Sent from the Wicket - User mailing > list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Ryan Gravener http://twitter.com/ryangravener - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Form model update with ajax using AutoCompleteTextField
You can search the archives for the answer to this one. Essentially the model object for autocomplete is just a string. On 10/13/08, kerim bey <[EMAIL PROTECTED]> wrote: > > Hi! > > I have problems with using an AutoCompleteText field. > Loading the choice Objects works fine, but when I select an entry the > ModelObject (using a CompoundPropertyModel) of the Form is not updated. > Calling setModelObject() doesn't seem to have any effect. > > Using a DropDownChoice the same way works. > > What is missing? > -- > View this message in context: > http://www.nabble.com/Form-model-update-with-ajax-using-AutoCompleteTextField-tp19954381p19954381.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Ryan Gravener http://twitter.com/ryangravener - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]