You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ryan <wi...@mandrake.us> on 2008/10/28 04:32:23 UTC
Changing model of TextField with DDC
I have a search page that lets the use enter the search term in a
TextField and select the field to search with a DDC. Using
onSelectionChanged I am able to create a new TextField pointing to the
new model that was selected in the DDC and everything works as expected.
However, if I do not want to use javascript and the roundtrip for
onSelectionChanged what would be the best way to implement this?
Here is the onSelectionChanged method for clarification:
protected void onSelectionChanged(Object o) {
super.onSelectionChanged(o);
field = new TextField("test",new PropertyModel(HomePage.this,o.toString()));
if(val.equals("test3")) {
field.add(NumberValidator.RangeValidator.range(100,200));
}
f.addOrReplace(field);
}
Thanks,
Ryan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Changing model of TextField with DDC
Posted by Ryan <wi...@mandrake.us>.
Yea, I've started to come to that conclusion.
Thanks Igor!
Ryan
On Tue, Oct 28, 2008 at 09:14:42AM -0700, Igor Vaynberg exclaimed:
>this really looks like a hack :) you should keep the field and text in
>two different fields, and then in form.onsubmit do the right thing.
>
>-igor
>
>On Mon, Oct 27, 2008 at 8:32 PM, Ryan <wi...@mandrake.us> wrote:
>> I have a search page that lets the use enter the search term in a
>> TextField and select the field to search with a DDC. Using
>> onSelectionChanged I am able to create a new TextField pointing to the
>> new model that was selected in the DDC and everything works as expected.
>>
>> However, if I do not want to use javascript and the roundtrip for
>> onSelectionChanged what would be the best way to implement this?
>>
>> Here is the onSelectionChanged method for clarification:
>>
>> protected void onSelectionChanged(Object o) {
>> super.onSelectionChanged(o);
>> field = new TextField("test",new PropertyModel(HomePage.this,o.toString()));
>> if(val.equals("test3")) {
>> field.add(NumberValidator.RangeValidator.range(100,200));
>> }
>> f.addOrReplace(field);
>> }
>>
>> Thanks,
>> Ryan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Changing model of TextField with DDC
Posted by Igor Vaynberg <ig...@gmail.com>.
this really looks like a hack :) you should keep the field and text in
two different fields, and then in form.onsubmit do the right thing.
-igor
On Mon, Oct 27, 2008 at 8:32 PM, Ryan <wi...@mandrake.us> wrote:
> I have a search page that lets the use enter the search term in a
> TextField and select the field to search with a DDC. Using
> onSelectionChanged I am able to create a new TextField pointing to the
> new model that was selected in the DDC and everything works as expected.
>
> However, if I do not want to use javascript and the roundtrip for
> onSelectionChanged what would be the best way to implement this?
>
> Here is the onSelectionChanged method for clarification:
>
> protected void onSelectionChanged(Object o) {
> super.onSelectionChanged(o);
> field = new TextField("test",new PropertyModel(HomePage.this,o.toString()));
> if(val.equals("test3")) {
> field.add(NumberValidator.RangeValidator.range(100,200));
> }
> f.addOrReplace(field);
> }
>
> Thanks,
> Ryan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org