Any solution that doesn't require nested forms? On Thu, Feb 25, 2010 at 5:33 PM, Igor Vaynberg <igor.vaynb...@gmail.com>wrote:
> easy. put each section into its own form, all inside the one big form. > if a button of the inner form is pressed only that form is validated, > while values for the entire form are preserved. > > there is a wiki page which explains how embedded forms work. > > -igor > > On Thu, Feb 25, 2010 at 4:30 PM, Tony Wu <e90t...@gmail.com> wrote: > > Thanks Igor, my use case was an attempt to solve a bigger problem. Let me > > try to describe the main problem I am trying to solve: > > > > I have 1 big form with 3 distinct sections. Each section has an "update" > > link which should run every FormComponent's validators for that section. > The > > trick is I can't use form submission because I don't want to validate the > > other parts of the form, just that 1 section and provide error feedback > if > > necessary. The final button on the form is an actual submit, which will > run > > through every FormComponent's validators on the page. I thought about > > splitting it up into 3 separate forms so each "update" link is actually a > > submit, but the final button needs to validate every input in every > section > > - so that's why I'm using 1 form. I thought about nested forms as well, > but > > that isn't syntactically correct in HTML. > > > > The crux of the problem is I need to run validators for only specific > > FormComponents without doing a form submit. Is there any way I can do > that > > with wicket? > > > > Thanks, > > Tony > > > > On Thu, Feb 25, 2010 at 5:00 PM, Igor Vaynberg <igor.vaynb...@gmail.com > >wrote: > > > >> links do not transfer form values to the serverside, so you need to > >> use a bit of js to do it for you. not sure exactly what your usecase > >> is (sounds strange), but here goes off the top of my head: > >> > >> abstract class myuberlink extends link { > >> private final textfield tf; > >> public myuberlink(string id, textfield tf) { super(id);this.tf=tf; > >> tf.setoutputmarkupid(true);} > >> public void oncomponenttag(tag) { > >> > >> > > tag.put("onclick","this.href=this.href+'&"+tf.getinputname()+"='+document.getElementById('"+tf.getmarkupid()+"').value; > >> return true;"); } > >> > >> public final void onclick() { > >> onclick(getrequest().getattribute(tf.getinputname()); } > >> > >> protected abstract void onclick(string value); > >> } > >> > >> -igor > >> > >> On Thu, Feb 25, 2010 at 3:51 PM, Tony Wu <e90t...@gmail.com> wrote: > >> > Is there a way to get a TextField's value without submitting the form? > >> For > >> > example, if I have a TextField and a Link (not a submit Button), I > want > >> the > >> > Link's onClick to System.out.println the TextField's value at that > time. > >> I > >> > tried using TextField.getInput, getConvertedInput, no dice on both. > >> > > >> > I even tried adding a AjaxFormComponentUpdatingBehavior to the > TextField > >> for > >> > "onchange", which does work to change the TextField's model whenever a > >> user > >> > types something, but it's getInput and getConvertedInput is always > null > >> when > >> > I click the Link. Even if the AjaxFormComponentUpdatingBehavior's > >> onUpdate I > >> > do TextField.setConvertedInput(model's new value) explicity, both > >> getInput > >> > and getConvertedInput are both null. > >> > > >> > Any ideas? > >> > > >> > >> --------------------------------------------------------------------- > >> 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 > >