Re: AjaxButton and a HiddenField
If you're working with Wicket, you should probably use Models and not set its value via JavaScript unless of course that's your business use-case. Mixing JavaScript, Ajax and a Wicket component seems a bit too elaborated for something simple such as persisting state via a hidden form field. Btw, are you sure you need the hidden field? Can’t you use compound models to hold on to the state you need at the panel or page level? Anyhow, I'll let you to it.. :) ~ Thank you, Paul Bors On Tue, Feb 12, 2013 at 10:02 AM, Entropy wrote: > Well, I solved it and it turns out that it wasn't a Wicket issue. I was > setting the value in javascript, but I eventually realized that I was > setting it to the wrong object...so when i stepped and saw the value, I > assumed that it was in the hidden, but I was wrong. > > Ooops. Thanks for your effort anyway gang. > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/AjaxButton-and-a-HiddenField-tp4656246p4656277.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: AjaxButton and a HiddenField
Well, I solved it and it turns out that it wasn't a Wicket issue. I was setting the value in javascript, but I eventually realized that I was setting it to the wrong object...so when i stepped and saw the value, I assumed that it was in the hidden, but I was wrong. Ooops. Thanks for your effort anyway gang. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxButton-and-a-HiddenField-tp4656246p4656277.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: AjaxButton and a HiddenField
The code looks OK. It seems the JavaScript doesn't serialize the hidden field and doesn't include it in the submit data. If you are able to reproduce this with Wicket 6 please file a ticket with a quickstart. Unfortunately 1.4.7 is too old and is not supported by us anymore. On Tue, Feb 12, 2013 at 3:34 PM, Entropy wrote: > Yes, I have a form (wicket Form) around both the hidden and the ajaxbutton. > We appear to be on 1.4.7. > > The java for the ajaxbutton looks like so: > > form.add(new AjaxButton("gridtestbutton") { > protected void onSubmit(AjaxRequestTarget arg0, Form arg1) { > //some code that gets the HiddenField, parses it, and reacts...but the > value is always empty. > } > }); > > The code that adds the hidden looks like: > > add(new HiddenField("rowsSelected", new Model(""))); > > That add adds to a custom panel that holds the hidden, and is in turn is > added to the form. > > > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/AjaxButton-and-a-HiddenField-tp4656246p4656275.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 > > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com <http://jweekend.com/>
Re: AjaxButton and a HiddenField
Yes, I have a form (wicket Form) around both the hidden and the ajaxbutton. We appear to be on 1.4.7. The java for the ajaxbutton looks like so: form.add(new AjaxButton("gridtestbutton") { protected void onSubmit(AjaxRequestTarget arg0, Form arg1) { //some code that gets the HiddenField, parses it, and reacts...but the value is always empty. } }); The code that adds the hidden looks like: add(new HiddenField("rowsSelected", new Model(""))); That add adds to a custom panel that holds the hidden, and is in turn is added to the form. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxButton-and-a-HiddenField-tp4656246p4656275.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: AjaxButton and a HiddenField
To elaborate, I already made the Hidden a HiddenField, it just doesn't get updated before the onSubmit(). The Hidden's value is set via javascript on the client, and I want that value as INPUT into the code tha truns in onSubmit. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxButton-and-a-HiddenField-tp4656246p4656274.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: AjaxButton and a HiddenField
Hi, AjaxButton just submits a form using XmlHttpRequest, or IFrame when there is file input in the form. Is the hidden input field part of that form ? Which version of Wicket do you use ? Can you show us the related Java and HTML snippets ? On Tue, Feb 12, 2013 at 3:15 PM, Entropy wrote: > Okay, so the only AjaxRequestTarget I am aware of is the one passed to me > in > the onSubmit. This being after the ajax has submitted. I thought that was > for OUTPUT, ie what controls will the ajax update when it returns from the > ajax event. > > I am not trying to update the hiddenfield in the ajaxbutton, but rather > using what is there are input into the code that will run during my > onSubmit. I can't seem to find where I would register the hiddenfield with > the ajaxbutton BEFORE the ajax event. > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/AjaxButton-and-a-HiddenField-tp4656246p4656270.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 > > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com <http://jweekend.com/>
Re: AjaxButton and a HiddenField
Okay, so the only AjaxRequestTarget I am aware of is the one passed to me in the onSubmit. This being after the ajax has submitted. I thought that was for OUTPUT, ie what controls will the ajax update when it returns from the ajax event. I am not trying to update the hiddenfield in the ajaxbutton, but rather using what is there are input into the code that will run during my onSubmit. I can't seem to find where I would register the hiddenfield with the ajaxbutton BEFORE the ajax event. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxButton-and-a-HiddenField-tp4656246p4656270.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: AjaxButton and a HiddenField
You turn your hidden field into a Wicket FormComponent and then add it to your button's ajax request target :) Just because is hidden, it doesn't have to be treated any different. But don't confuse a hidden field with a Wicket visible field. ~ Thak you, Paul Bors On Mon, Feb 11, 2013 at 3:25 PM, Entropy wrote: > I have a javascript component that updates a HiddenField. Then I want to > submit to the server via an AjaxButton. It all works fine until I try to > get the value of the hiddenField which evidently did NOT hitch a ride on > the > Ajax request. How do I get the hiddenfield to join the ajax request? > > Thanks. > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/AjaxButton-and-a-HiddenField-tp4656246.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 > >
AjaxButton and a HiddenField
I have a javascript component that updates a HiddenField. Then I want to submit to the server via an AjaxButton. It all works fine until I try to get the value of the hiddenField which evidently did NOT hitch a ride on the Ajax request. How do I get the hiddenfield to join the ajax request? Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxButton-and-a-HiddenField-tp4656246.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