You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by fe...@osmanager.com.br on 2010/03/19 15:48:06 UTC

[TOBAGO] SelectOneChoice and Rendered attribute

Hello,
Here I am with another newbie question (I guess I'll start a blog devoted
for Tobago learning). I have the following problem:
I have a SelectOneChoice with specific values. When I change this value, I
want to make a few fields from the form to appear or disappear... I tried:

<tx:selectOneChoice label="Resultado" value="#{dealer.cntNovo.tipo}"
tabIndex="0" immediate="true">					<tc:selectItem itemLabel="Agendamento de
Visita" itemValue="1" />
	<tc:selectItem itemLabel="Recusa de Visita" itemValue="2" />
	<tc:selectItem itemLabel="Reagendamento de Visita" itemValue="3" />
	<tc:selectItem itemLabel="Aceite de Proposta" itemValue="4" />
</tx:selectOneChoice>
<tx:date label="Remarcado para" value="#{dealer.cntNovo.qdo}"
rendered="#{dealer.cntNovo.tipo==3}" />

But that approach didn't worked as expected.

What can I do to make this TX:DATE to appear just after the
selectOneChoice change it's value to 3 and disappear with any other
value???

Best Regards,

Fernando Augusto

Re: [TOBAGO] SelectOneChoice and Rendered attribute

Posted by Helmut Swaczinna <my...@wlp-systems.de>.
The value of tc:attribute is *relative* to the enclosing naming container (page 
or subview). So value="panel" (or "box") should be correct. When you want to use 
an absolute id, you must preceed the concatenated id with an extra colon, e.g. 
":page:panel". When you see the value changing in the model, than the id should 
be correct.

You can try it without Ajax also. When you omit the tc:attribute tag, the whole 
page should be reloaded, when the value of the selectOneChoice changes.

Helmut

Am 20.03.2010 15:15, schrieb Udo Schnurpfeil:
> You may have a type problem. Maybe the itemValue allows only Strings.
> When you don't set immediate=true you will see an error in that case.
> You can also use tc:selectItems with a class model. With that integer
> value should work.
>
> The value for tc:attribute is the clientId of the component: This is the
> chain of all naming containers.
> On a simple page, you have only tc:page as naming container. Put
> id="page" then you need value="page:panel".
> You can check the clientId in the HTML Source Code.
>
> Am 19.03.10 19:40, schrieb Fernando Augusto:
>> Well...
>>
>> Getting deeper in the problem, I've seen that the problem is in the
>> ajax return, for it does not change the content of the box (or panel).
>> I guess it is something related with the value passed as tc:attribute
>> value. I've seen in a few tutorials and codes around, that addressing
>> nested containers, you should use a long value, full of ":", but I
>> couldn't understand that part...
>>
>> Can someone help me with that???
>>
>> Fernando Augusto escreveu:
>>> Hello,
>>>
>>> I´ve seen that the AJAX part works and the value changes, but the
>>> tx:date keeps hidden even with the right value... Any other newbie
>>> mistake in the code?
>>>
>>> Regards,
>>>
>>> Fernando Augusto
>>>
>>> Helmut Swaczinna escreveu:
>>>> I think, yes, this should work too.
>>>>
>>>> Helmut
>>>>
>>>> Am 19.03.2010 15:58, schrieb fernando@osmanager.com.br:
>>>>> Helmut,
>>>>>
>>>>> Can I do it with the tc:box they are inside?
>>>>>
>>>>> Regards,
>>>>>
>>>>> Fernando Augusto
>>>>>
>>>>>> Hi Fernando,
>>>>>>
>>>>>> add a command tag to the selectOneChoice and enclose the
>>>>>> selectOneChoice
>>>>>> and
>>>>>> date within a panel:
>>>>>>
>>>>>> <tc:panel id="panel">
>>>>>>
>>>>>> <tx:selectOneChoice ...
>>>>>> <f:facet name="change">
>>>>>> <tc:command>
>>>>>> <tc:attribute name="renderedPartially"
>>>>>> value="panel"/>
>>>>>> </tc:command>
>>>>>> </f:facet>
>>>>>> </tx:selectOneChoice>
>>>>>> <tx:date ...
>>>>>>
>>>>>> </tc:panel>
>>>>>>
>>>>>> Now the panel gets reloaded by Ajax, when the selection changes.
>>>>>>
>>>>>> Regards
>>>>>> Helmut
>>>>>>
>>>>>
>>>>
>>>
>>>
>>
>>

Re: [TOBAGO] SelectOneChoice and Rendered attribute

Posted by Udo Schnurpfeil <ud...@schnurpfeil.de>.
You may have a type problem. Maybe the itemValue allows only Strings.
When you don't set immediate=true you will see an error in that case.
You can also use tc:selectItems with a class model. With that integer 
value should work.

The value for tc:attribute is the clientId of the component: This is the 
chain of all naming containers.
On a simple page, you have only tc:page as naming container. Put 
id="page" then you need value="page:panel".
You can check the clientId in the HTML Source Code.

Am 19.03.10 19:40, schrieb Fernando Augusto:
> Well...
>
> Getting deeper in the problem, I've seen that the problem is in the 
> ajax return, for it does not change the content of the box (or panel). 
> I guess it is something related with the value passed as tc:attribute 
> value. I've seen in a few tutorials and codes around, that addressing 
> nested containers, you should use a long value, full of ":", but I 
> couldn't understand that part...
>
> Can someone help me with that???
>
> Fernando Augusto escreveu:
>> Hello,
>>
>> I´ve seen that the AJAX part works and the value changes, but the 
>> tx:date keeps hidden even with the right value... Any other newbie 
>> mistake in the code?
>>
>> Regards,
>>
>> Fernando Augusto
>>
>> Helmut Swaczinna escreveu:
>>> I think, yes, this should work too.
>>>
>>> Helmut
>>>
>>> Am 19.03.2010 15:58, schrieb fernando@osmanager.com.br:
>>>> Helmut,
>>>>
>>>> Can I do it with the tc:box they are inside?
>>>>
>>>> Regards,
>>>>
>>>> Fernando Augusto
>>>>
>>>>> Hi Fernando,
>>>>>
>>>>> add a command tag to the selectOneChoice and enclose the 
>>>>> selectOneChoice
>>>>> and
>>>>> date within a panel:
>>>>>
>>>>> <tc:panel id="panel">
>>>>>
>>>>> <tx:selectOneChoice ...
>>>>> <f:facet name="change">
>>>>> <tc:command>
>>>>> <tc:attribute name="renderedPartially"
>>>>>                       value="panel"/>
>>>>> </tc:command>
>>>>> </f:facet>
>>>>> </tx:selectOneChoice>
>>>>> <tx:date ...
>>>>>
>>>>> </tc:panel>
>>>>>
>>>>> Now the panel gets reloaded by Ajax, when the selection changes.
>>>>>
>>>>> Regards
>>>>> Helmut
>>>>>
>>>>
>>>
>>
>>
>
>

Re: [TOBAGO] SelectOneChoice and Rendered attribute

Posted by Fernando Augusto <fe...@osmanager.com.br>.
Well...

Getting deeper in the problem, I've seen that the problem is in the ajax 
return, for it does not change the content of the box (or panel). I 
guess it is something related with the value passed as tc:attribute 
value. I've seen in a few tutorials and codes around, that addressing 
nested containers, you should use a long value, full of ":", but I 
couldn't understand that part...

Can someone help me with that???

Fernando Augusto escreveu:
> Hello,
>
> I´ve seen that the AJAX part works and the value changes, but the 
> tx:date keeps hidden even with the right value... Any other newbie 
> mistake in the code?
>
> Regards,
>
> Fernando Augusto
>
> Helmut Swaczinna escreveu:
>> I think, yes, this should work too.
>>
>> Helmut
>>
>> Am 19.03.2010 15:58, schrieb fernando@osmanager.com.br:
>>> Helmut,
>>>
>>> Can I do it with the tc:box they are inside?
>>>
>>> Regards,
>>>
>>> Fernando Augusto
>>>
>>>> Hi Fernando,
>>>>
>>>> add a command tag to the selectOneChoice and enclose the 
>>>> selectOneChoice
>>>> and
>>>> date within a panel:
>>>>
>>>> <tc:panel id="panel">
>>>>
>>>> <tx:selectOneChoice ...
>>>>                 <f:facet name="change">
>>>>                   <tc:command>
>>>>                     <tc:attribute name="renderedPartially"
>>>>                       value="panel"/>
>>>>                   </tc:command>
>>>>                 </f:facet>
>>>> </tx:selectOneChoice>
>>>> <tx:date ...
>>>>
>>>> </tc:panel>
>>>>
>>>> Now the panel gets reloaded by Ajax, when the selection changes.
>>>>
>>>> Regards
>>>> Helmut
>>>>
>>>
>>
>
>


Re: [TOBAGO] SelectOneChoice and Rendered attribute

Posted by Fernando Augusto <fe...@osmanager.com.br>.
Hello,

I´ve seen that the AJAX part works and the value changes, but the 
tx:date keeps hidden even with the right value... Any other newbie 
mistake in the code?

Regards,

Fernando Augusto

Helmut Swaczinna escreveu:
> I think, yes, this should work too.
>
> Helmut
>
> Am 19.03.2010 15:58, schrieb fernando@osmanager.com.br:
>> Helmut,
>>
>> Can I do it with the tc:box they are inside?
>>
>> Regards,
>>
>> Fernando Augusto
>>
>>> Hi Fernando,
>>>
>>> add a command tag to the selectOneChoice and enclose the 
>>> selectOneChoice
>>> and
>>> date within a panel:
>>>
>>> <tc:panel id="panel">
>>>
>>> <tx:selectOneChoice ...
>>>                 <f:facet name="change">
>>>                   <tc:command>
>>>                     <tc:attribute name="renderedPartially"
>>>                       value="panel"/>
>>>                   </tc:command>
>>>                 </f:facet>
>>> </tx:selectOneChoice>
>>> <tx:date ...
>>>
>>> </tc:panel>
>>>
>>> Now the panel gets reloaded by Ajax, when the selection changes.
>>>
>>> Regards
>>> Helmut
>>>
>>
>


Re: [TOBAGO] SelectOneChoice and Rendered attribute

Posted by Helmut Swaczinna <my...@wlp-systems.de>.
I think, yes, this should work too.

Helmut

Am 19.03.2010 15:58, schrieb fernando@osmanager.com.br:
> Helmut,
>
> Can I do it with the tc:box they are inside?
>
> Regards,
>
> Fernando Augusto
>
>> Hi Fernando,
>>
>> add a command tag to the selectOneChoice and enclose the selectOneChoice
>> and
>> date within a panel:
>>
>> <tc:panel id="panel">
>>
>> <tx:selectOneChoice ...
>>                 <f:facet name="change">
>>                   <tc:command>
>>                     <tc:attribute name="renderedPartially"
>>                       value="panel"/>
>>                   </tc:command>
>>                 </f:facet>
>> </tx:selectOneChoice>
>> <tx:date ...
>>
>> </tc:panel>
>>
>> Now the panel gets reloaded by Ajax, when the selection changes.
>>
>> Regards
>> Helmut
>>
>

Re: [TOBAGO] SelectOneChoice and Rendered attribute

Posted by fe...@osmanager.com.br.
Helmut,

Can I do it with the tc:box they are inside?

Regards,

Fernando Augusto

> Hi Fernando,
> 
> add a command tag to the selectOneChoice and enclose the selectOneChoice
> and 
> date within a panel:
> 
> <tc:panel id="panel">
> 
> <tx:selectOneChoice ...
>                <f:facet name="change">
>                  <tc:command>
>                    <tc:attribute name="renderedPartially"
>                      value="panel"/>
>                  </tc:command>
>                </f:facet>
> </tx:selectOneChoice>
> <tx:date ...
> 
> </tc:panel>
> 
> Now the panel gets reloaded by Ajax, when the selection changes.
> 
> Regards
> Helmut
> 


Re: [TOBAGO] SelectOneChoice and Rendered attribute

Posted by Helmut Swaczinna <my...@wlp-systems.de>.
Hi Fernando,

add a command tag to the selectOneChoice and enclose the selectOneChoice and 
date within a panel:

<tc:panel id="panel">

<tx:selectOneChoice ...
               <f:facet name="change">
                 <tc:command>
                   <tc:attribute name="renderedPartially"
                     value="panel"/>
                 </tc:command>
               </f:facet>
</tx:selectOneChoice>
<tx:date ...

</tc:panel>

Now the panel gets reloaded by Ajax, when the selection changes.

Regards
Helmut

Am 19.03.2010 15:48, schrieb fernando@osmanager.com.br:
> Hello,
> Here I am with another newbie question (I guess I'll start a blog devoted
> for Tobago learning). I have the following problem:
> I have a SelectOneChoice with specific values. When I change this value, I
> want to make a few fields from the form to appear or disappear... I tried:
>
> <tx:selectOneChoice label="Resultado" value="#{dealer.cntNovo.tipo}"
> tabIndex="0" immediate="true">					<tc:selectItem itemLabel="Agendamento de
> Visita" itemValue="1" />
> 	<tc:selectItem itemLabel="Recusa de Visita" itemValue="2" />
> 	<tc:selectItem itemLabel="Reagendamento de Visita" itemValue="3" />
> 	<tc:selectItem itemLabel="Aceite de Proposta" itemValue="4" />
> </tx:selectOneChoice>
> <tx:date label="Remarcado para" value="#{dealer.cntNovo.qdo}"
> rendered="#{dealer.cntNovo.tipo==3}" />
>
> But that approach didn't worked as expected.
>
> What can I do to make this TX:DATE to appear just after the
> selectOneChoice change it's value to 3 and disappear with any other
> value???
>
> Best Regards,
>
> Fernando Augusto