Re: Changing model of TextField with DDC

2008-10-28 Thread Ryan
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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Changing model of TextField with DDC

2008-10-28 Thread Igor Vaynberg
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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Changing model of TextField with DDC

2008-10-27 Thread Ryan
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]