You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Leon Derks <le...@cumquat.nl> on 2008/05/13 16:56:04 UTC
update select based on first select
I want to update a select, based on a value from another select.
I have tried the OnEvent mixin from the t5components, but only the first
selected value is printed to the screen.
When I select another value after that, it always prints the first
selected value.
How can I do this with Tapestry 5 at the moment?
Here is a part of the java page code:
@OnEvent(component = "productSelect", value = "change")
Object onProductSelectChanged(String value)
{
System.out.println("Value: " + value);
return null;
}
Leon
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: update select based on first select
Posted by Sven Homburg <ho...@googlemail.com>.
sorry, one typo
@OnEvent(component = "*selectField*", value = "change")
public void onChange(String value)
{
System.err.println(value)
}
2008/5/13 Sven Homburg <ho...@googlemail.com>:
> your page class:
>
> @Property
> private ValueEnum _selectedItem;
>
> @Component(parameters = {"model=testModel", "value=selectedItem",
> "event=change", "onCompleteCallback=onSelectCompleteFunction"})
> @Mixins(value = "t5components/OnEvent")
> private Select _selectField;
>
> public SelectModel getTestModel()
> {
> return new EnumSelectModel(ValueEnum.class, _messages);
> }
>
> @OnEvent(component = "select", value = "change")
> public void onChange(String value)
> {
> System.err.println(value)
> }
>
> your page template
>
> <select t:id="selectField" size="1">
> <option value="1">Value 1</option>
> </select>
>
> 2008/5/13 Leon Derks <le...@cumquat.nl>:
>
> Hi Chris,
> >
> > Thanks for your answer,
> >
> > this is the other part:
> > <t:select t:id="productSelect" value="productCategory"
> > blankLabel="${message:text-all}" t:mixins="t5components/OnEvent"
> > event="change" />
> >
> > The System.out.println("Value: " + value) in my java code always prints
> > the first selected value. After that always the first value is printed, no
> > matter what value I select.
> >
> > What am I doing wrong?
> >
> > Leon
> >
> >
> > Chris Lewis wrote:
> >
> > > Leon,
> > >
> > > I can't tell from that code where/how you've used the OnEvent mixin. I
> > > see the @OnEvent annotation, but that's unrelated (as you probably
> > > realize). This exact use case was discussed recently - see:
> > >
> > >
> > > http://markmail.org/search/?q=ajax-based+data+retrieval+list%3Aorg.apache.tapestry.users#query:ajax-based%20data%20retrieval%20list%3Aorg.apache.tapestry.users+page:1+mid:5srufbsi5jsrdmu2+state:results
> > >
> > > chris
> > >
> > > Leon Derks wrote:
> > >
> > >
> > > > I want to update a select, based on a value from another select.
> > > >
> > > > I have tried the OnEvent mixin from the t5components, but only the
> > > > first selected value is printed to the screen.
> > > > When I select another value after that, it always prints the first
> > > > selected value.
> > > >
> > > > How can I do this with Tapestry 5 at the moment?
> > > >
> > > > Here is a part of the java page code:
> > > >
> > > > @OnEvent(component = "productSelect", value = "change")
> > > > Object onProductSelectChanged(String value)
> > > > {
> > > > System.out.println("Value: " + value);
> > > > return null;
> > > > }
> > > >
> > > > Leon
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> with regards
> Sven Homburg
> http://tapestry5-components.googlecode.com
--
with regards
Sven Homburg
http://tapestry5-components.googlecode.com
Re: update select based on first select
Posted by Sven Homburg <ho...@googlemail.com>.
your page class:
@Property
private ValueEnum _selectedItem;
@Component(parameters = {"model=testModel", "value=selectedItem",
"event=change", "onCompleteCallback=onSelectCompleteFunction"})
@Mixins(value = "t5components/OnEvent")
private Select _selectField;
public SelectModel getTestModel()
{
return new EnumSelectModel(ValueEnum.class, _messages);
}
@OnEvent(component = "select", value = "change")
public void onChange(String value)
{
System.err.println(value)
}
your page template
<select t:id="selectField" size="1">
<option value="1">Value 1</option>
</select>
2008/5/13 Leon Derks <le...@cumquat.nl>:
> Hi Chris,
>
> Thanks for your answer,
>
> this is the other part:
> <t:select t:id="productSelect" value="productCategory"
> blankLabel="${message:text-all}" t:mixins="t5components/OnEvent"
> event="change" />
>
> The System.out.println("Value: " + value) in my java code always prints
> the first selected value. After that always the first value is printed, no
> matter what value I select.
>
> What am I doing wrong?
>
> Leon
>
>
> Chris Lewis wrote:
>
> > Leon,
> >
> > I can't tell from that code where/how you've used the OnEvent mixin. I
> > see the @OnEvent annotation, but that's unrelated (as you probably
> > realize). This exact use case was discussed recently - see:
> >
> >
> > http://markmail.org/search/?q=ajax-based+data+retrieval+list%3Aorg.apache.tapestry.users#query:ajax-based%20data%20retrieval%20list%3Aorg.apache.tapestry.users+page:1+mid:5srufbsi5jsrdmu2+state:results
> >
> > chris
> >
> > Leon Derks wrote:
> >
> >
> > > I want to update a select, based on a value from another select.
> > >
> > > I have tried the OnEvent mixin from the t5components, but only the
> > > first selected value is printed to the screen.
> > > When I select another value after that, it always prints the first
> > > selected value.
> > >
> > > How can I do this with Tapestry 5 at the moment?
> > >
> > > Here is a part of the java page code:
> > >
> > > @OnEvent(component = "productSelect", value = "change")
> > > Object onProductSelectChanged(String value)
> > > {
> > > System.out.println("Value: " + value);
> > > return null;
> > > }
> > >
> > > Leon
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> > >
> > >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
with regards
Sven Homburg
http://tapestry5-components.googlecode.com
Re: update select based on first select
Posted by Leon Derks <le...@cumquat.nl>.
Hi Chris,
Thanks for your answer,
this is the other part:
<t:select t:id="productSelect" value="productCategory"
blankLabel="${message:text-all}" t:mixins="t5components/OnEvent"
event="change" />
The System.out.println("Value: " + value) in my java code always prints
the first selected value. After that always the first value is printed,
no matter what value I select.
What am I doing wrong?
Leon
Chris Lewis wrote:
> Leon,
>
> I can't tell from that code where/how you've used the OnEvent mixin. I
> see the @OnEvent annotation, but that's unrelated (as you probably
> realize). This exact use case was discussed recently - see:
>
> http://markmail.org/search/?q=ajax-based+data+retrieval+list%3Aorg.apache.tapestry.users#query:ajax-based%20data%20retrieval%20list%3Aorg.apache.tapestry.users+page:1+mid:5srufbsi5jsrdmu2+state:results
>
> chris
>
> Leon Derks wrote:
>
>> I want to update a select, based on a value from another select.
>>
>> I have tried the OnEvent mixin from the t5components, but only the
>> first selected value is printed to the screen.
>> When I select another value after that, it always prints the first
>> selected value.
>>
>> How can I do this with Tapestry 5 at the moment?
>>
>> Here is a part of the java page code:
>>
>> @OnEvent(component = "productSelect", value = "change")
>> Object onProductSelectChanged(String value)
>> {
>> System.out.println("Value: " + value);
>> return null;
>> }
>>
>> Leon
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: update select based on first select
Posted by Chris Lewis <ch...@bellsouth.net>.
Leon,
I can't tell from that code where/how you've used the OnEvent mixin. I
see the @OnEvent annotation, but that's unrelated (as you probably
realize). This exact use case was discussed recently - see:
http://markmail.org/search/?q=ajax-based+data+retrieval+list%3Aorg.apache.tapestry.users#query:ajax-based%20data%20retrieval%20list%3Aorg.apache.tapestry.users+page:1+mid:5srufbsi5jsrdmu2+state:results
chris
Leon Derks wrote:
> I want to update a select, based on a value from another select.
>
> I have tried the OnEvent mixin from the t5components, but only the
> first selected value is printed to the screen.
> When I select another value after that, it always prints the first
> selected value.
>
> How can I do this with Tapestry 5 at the moment?
>
> Here is a part of the java page code:
>
> @OnEvent(component = "productSelect", value = "change")
> Object onProductSelectChanged(String value)
> {
> System.out.println("Value: " + value);
> return null;
> }
>
> Leon
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
http://thegodcode.net
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org