You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vinicius Carvalho <ca...@superig.com.br> on 2004/01/23 13:29:46 UTC

retreiving the labelProperty of an option tag

Hi there! I have a code to render a select/option that looks like this :

<html:options collection="Objectives" property="objCode" 
labelProperty="objDescription"/>

In my form I have the getter for this, that returns the code for the 
desired Objective.
So in my action, when I fill the VO, I add the code by:
ModelVO.setObjective(form.getObjective());

Ok, so far so good. But how do I get the labelProperty for this objective? 
Once my form gets only the property ....

Thanks

Vinicius 


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: retreiving the labelProperty of an option tag

Posted by Vinicius Carvalho <ca...@superig.com.br>.
Thax, I'll try the javascript approach, cuz the collection gets lost, it's 
visible only on request scope for that page, performance issues ;)
But thanks for the hint ;)


At 11:17 23/1/2004, you wrote:
>That's correct, the form is only going to submit the value not the label for
>the option.  You might use javascript to populate a hidden field with the
>label so it gets submitted, if you really wanted to, but it would be much
>easier to just look up the label in your action using the value you received
>in the form and the collection that populated the list.
>
>-Rob
>
>
>-----Original Message-----
>From: Vinicius Carvalho [mailto:carvalho.vinicius@superig.com.br]
>Sent: Friday, January 23, 2004 7:30 AM
>To: struts-user@jakarta.apache.org
>Subject: retreiving the labelProperty of an option tag
>
>Hi there! I have a code to render a select/option that looks like this :
>
>labelProperty="objDescription"/> In my form I have the getter for this, 
>that returns the code for the desired Objective. So in my action, when I 
>fill the VO, I add the code by: ModelVO.setObjective(form.getObjective()); 
>Ok, so far so good. But how do I get the labelProperty for this objective? 
>Once my form gets only the property .... Thanks Vinicius 
>--------------------------------------------------------------------- To 
>unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org For 
>additional commands, e-mail: struts-user-help@jakarta.apache.org 
>--------------------------------------------------------------------- To 
>unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org For 
>additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: retreiving the labelProperty of an option tag

Posted by Robert Nocera <rn...@neosllc.com>.
That's correct, the form is only going to submit the value not the label for
the option.  You might use javascript to populate a hidden field with the
label so it gets submitted, if you really wanted to, but it would be much
easier to just look up the label in your action using the value you received
in the form and the collection that populated the list.

-Rob


-----Original Message-----
From: Vinicius Carvalho [mailto:carvalho.vinicius@superig.com.br] 
Sent: Friday, January 23, 2004 7:30 AM
To: struts-user@jakarta.apache.org
Subject: retreiving the labelProperty of an option tag

Hi there! I have a code to render a select/option that looks like this :

<html:options collection="Objectives" property="objCode" 
labelProperty="objDescription"/>

In my form I have the getter for this, that returns the code for the 
desired Objective.
So in my action, when I fill the VO, I add the code by:
ModelVO.setObjective(form.getObjective());

Ok, so far so good. But how do I get the labelProperty for this objective? 
Once my form gets only the property ....

Thanks

Vinicius 


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org