You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by lolowok <la...@air2web.fr> on 2007/10/09 14:26:00 UTC

[4.1.3] How to ? update a component with Select onchange

Hi,

I tried to update a component when a value changes in a Select, but i didn't
succeed.

How can i do that ?

what i tested : 

<div jwcid="myComponent@Any" renderTag="false">
<!-- display some values depends on the selected value in the select -->
...

<form jwcid="myForm@Form" listener="listener:changeView"
updateComponents="ognl:{components.myComponent.clientId}">     
<select jwcid="mySelection@Select" multiple="ognl:false" >
	<option jwcid="@Option" selected="ognl:selected[0]" label="0" />
   	<option jwcid="@Option" selected="ognl:selected[1]" label="1 />
	<option jwcid="@Option" selected="ognl:selected[2]" label="2" />
	<option jwcid="@Option" selected="ognl:selected[3]" label="3" />   	
 </select>
</form>


My java code :

    public void changeView()
    {
        // initialize new values do display in the component
    }
    
    @EventListener(elements = "mySelection", events = "onchange",
submitForm="myForm")
    public void interceptChangeView()
    {    	
    }

This solution works only the first time i change the value in the select.
But, it doesn't work the next times i change the value.






-- 
View this message in context: http://www.nabble.com/-4.1.3--How-to---update-a-component-with-Select-onchange-tf4593877.html#a13114539
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [4.1.3] How to ? update a component with Select onchange

Posted by lolowok <la...@air2web.fr>.
I solve the problem.

My select is in the component that i update, and this is the problem.
I put mySelection and myForm outside the updateDash@Any, and it works.

With this solution i can easily get the value selected.


remarks : on my side, when i use targets instead of elements, it doesn't
work.



Igor Drobiazko wrote:
> 
> Hi, try this
> 
> @EventListener(events="onChange", targets="mySelection")
> 
> You don't need to submit the form. So, submitForm is redundant.
> I would rather update the component "myComponent" within the method
> interceptChangeView()
> by calling ResponseBuilder#updateComponent("myComponent");
> 
> Regards
> 
> 
> On 10/9/07, lolowok <la...@air2web.fr> wrote:
>>
>>
>> Hi,
>>
>> I tried to update a component when a value changes in a Select, but i
>> didn't
>> succeed.
>>
>> How can i do that ?
>>
>> what i tested :
>>
>> <div jwcid="myComponent@Any" renderTag="false">
>> <!-- display some values depends on the selected value in the select -->
>> ...
>>
>> <form jwcid="myForm@Form" listener="listener:changeView"
>> updateComponents="ognl:{components.myComponent.clientId}">
>> <select jwcid="mySelection@Select" multiple="ognl:false" >
>>        <option jwcid="@Option" selected="ognl:selected[0]" label="0" />
>>        <option jwcid="@Option" selected="ognl:selected[1]" label="1 />
>>        <option jwcid="@Option" selected="ognl:selected[2]" label="2" />
>>        <option jwcid="@Option" selected="ognl:selected[3]" label="3" />
>> </select>
>> </form>
>>
>>
>> My java code :
>>
>>    public void changeView()
>>    {
>>        // initialize new values do display in the component
>>    }
>>
>>    @EventListener(elements = "mySelection", events = "onchange",
>> submitForm="myForm")
>>    public void interceptChangeView()
>>    {
>>    }
>>
>> This solution works only the first time i change the value in the select.
>> But, it doesn't work the next times i change the value.
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-4.1.3--How-to---update-a-component-with-Select-onchange-tf4593877.html#a13114539
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/-4.1.3--How-to---update-a-component-with-Select-onchange-tf4593877.html#a13132129
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [4.1.3] How to ? update a component with Select onchange

Posted by Igor Drobiazko <ig...@gmail.com>.
Hi, try this

@EventListener(events="onChange", targets="mySelection")

You don't need to submit the form. So, submitForm is redundant.
I would rather update the component "myComponent" within the method
interceptChangeView()
by calling ResponseBuilder#updateComponent("myComponent");

Regards


On 10/9/07, lolowok <la...@air2web.fr> wrote:
>
>
> Hi,
>
> I tried to update a component when a value changes in a Select, but i
> didn't
> succeed.
>
> How can i do that ?
>
> what i tested :
>
> <div jwcid="myComponent@Any" renderTag="false">
> <!-- display some values depends on the selected value in the select -->
> ...
>
> <form jwcid="myForm@Form" listener="listener:changeView"
> updateComponents="ognl:{components.myComponent.clientId}">
> <select jwcid="mySelection@Select" multiple="ognl:false" >
>        <option jwcid="@Option" selected="ognl:selected[0]" label="0" />
>        <option jwcid="@Option" selected="ognl:selected[1]" label="1 />
>        <option jwcid="@Option" selected="ognl:selected[2]" label="2" />
>        <option jwcid="@Option" selected="ognl:selected[3]" label="3" />
> </select>
> </form>
>
>
> My java code :
>
>    public void changeView()
>    {
>        // initialize new values do display in the component
>    }
>
>    @EventListener(elements = "mySelection", events = "onchange",
> submitForm="myForm")
>    public void interceptChangeView()
>    {
>    }
>
> This solution works only the first time i change the value in the select.
> But, it doesn't work the next times i change the value.
>
>
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/-4.1.3--How-to---update-a-component-with-Select-onchange-tf4593877.html#a13114539
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>