You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by johnson <jo...@erp.tw> on 2006/05/30 09:27:38 UTC

how to get the label of radio.

Hi!

does anyone know how to get the label of a radio in flowscript when user
choose a selection.

ie:

<fd:field id="inout">
<fd:label>
<i18n:text key="inout">inout</i18n:text>
</fd:label>
<fd:datatype base="string"/>
<fd:initial-value>1</fd:initial-value>
<fd:selection-list>
<fd:item value = "1">
<fd:label>
<i18n:text>check-in</i18n:text>
</fd:label>
</fd:item>
<fd:item value = "2">
<fd:label>
<i18n:text>check-out</i18n:text>
</fd:label>
</fd:item>
</fd:selection-list>
</fd:field>

here's a radio, when user choose 2, I want to get check-out(or others
depending on the i18n)

Best regards

johnson

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


Re: how to get the label of radio.

Posted by johnson <jo...@erp.tw>.
tks Simone

Because I want to use i18n.

Maybe try another method
How to use i18n in flowscript.

Best Regards

johnson

Simone Gianni 提到:

>Hi Johnson,
>it's not possible to retrieve the LABEL of a selection list (if not with
>an horrible and difficult trick : widget.getSelectionList() to retrieve
>the selection list, the selectionList.generateSaxFragment to stream the
>XML of the selection list, then find the label inside it).
>
>This is not because of a limitation in the framework, but because acting
>in the flow basing on the LABEL of a selection list is a bad practice
>and should not be done. Why not use something more meaningful as a value
>of the selection list, and then act in the flow based on the value
>(which is the righ way of doing it)? For example :
>
><fd:selection-list>
>  <fd:item value = "in">
>    <fd:label>
>      <i18n:text>check-in</i18n:text>
>    </fd:label>
>  </fd:item>
>  <fd:item value = "out">
>    <fd:label>
>      <i18n:text>check-out</i18n:text>
>    </fd:label>
>  </fd:item>
>
>
>var val = form.lookupWidget('inout').getValue();
>if (val == 'in') {
>
>} else if (val == 'out') {
>
>}
>
>
>Simone
>
>
>johnson wrote:
>
>  
>
>>Hi!
>>
>>does anyone know how to get the label of a radio in flowscript when user
>>choose a selection.
>>
>>ie:
>>
>><fd:field id="inout">
>><fd:label>
>><i18n:text key="inout">inout</i18n:text>
>></fd:label>
>><fd:datatype base="string"/>
>><fd:initial-value>1</fd:initial-value>
>><fd:selection-list>
>><fd:item value = "1">
>><fd:label>
>><i18n:text>check-in</i18n:text>
>></fd:label>
>></fd:item>
>><fd:item value = "2">
>><fd:label>
>><i18n:text>check-out</i18n:text>
>></fd:label>
>></fd:item>
>></fd:selection-list>
>></fd:field>
>>
>>here's a radio, when user choose 2, I want to get check-out(or others
>>depending on the i18n)
>>
>>Best regards
>>
>>johnson
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>For additional commands, e-mail: users-help@cocoon.apache.org
>>
>> 
>>
>>    
>>

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


Re: how to get the label of radio.

Posted by Simone Gianni <s....@thebug.it>.
Hi Johnson,
it's not possible to retrieve the LABEL of a selection list (if not with
an horrible and difficult trick : widget.getSelectionList() to retrieve
the selection list, the selectionList.generateSaxFragment to stream the
XML of the selection list, then find the label inside it).

This is not because of a limitation in the framework, but because acting
in the flow basing on the LABEL of a selection list is a bad practice
and should not be done. Why not use something more meaningful as a value
of the selection list, and then act in the flow based on the value
(which is the righ way of doing it)? For example :

<fd:selection-list>
  <fd:item value = "in">
    <fd:label>
      <i18n:text>check-in</i18n:text>
    </fd:label>
  </fd:item>
  <fd:item value = "out">
    <fd:label>
      <i18n:text>check-out</i18n:text>
    </fd:label>
  </fd:item>


var val = form.lookupWidget('inout').getValue();
if (val == 'in') {

} else if (val == 'out') {

}


Simone


johnson wrote:

>Hi!
>
>does anyone know how to get the label of a radio in flowscript when user
>choose a selection.
>
>ie:
>
><fd:field id="inout">
><fd:label>
><i18n:text key="inout">inout</i18n:text>
></fd:label>
><fd:datatype base="string"/>
><fd:initial-value>1</fd:initial-value>
><fd:selection-list>
><fd:item value = "1">
><fd:label>
><i18n:text>check-in</i18n:text>
></fd:label>
></fd:item>
><fd:item value = "2">
><fd:label>
><i18n:text>check-out</i18n:text>
></fd:label>
></fd:item>
></fd:selection-list>
></fd:field>
>
>here's a radio, when user choose 2, I want to get check-out(or others
>depending on the i18n)
>
>Best regards
>
>johnson
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>  
>
-- 
Simone Gianni

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