You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Anna Kerekes <An...@onx.com> on 2004/10/06 17:39:24 UTC

editing a form

Hello,
 
The user wishes to edit a message that was previously created.  In my edit.jsp I wish to display a dropdown
with the option that was previously selected as "selected".  Currently I have:
 
<html:select property="expiryDay">

        <html:options collection="days" property="idValue"  labelProperty="displayValue" />

</html:select>

I want the value of expiryDay from the database to be selected (by default) on the dropdown.  The user can select another option from the dropdown if they want to change it...

how do i do it in struts?

any help appreciated,

Anna


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


Re: editing a form

Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "Anna Kerekes" <An...@onx.com>
> I want the value of expiryDay from the database to be selected (by
default) on the dropdown.
> The user can select another option from the dropdown if they want to
change it...
> how do i do it in struts?

In the Action code, set the 'expiryDay' property of the form bean.  Then
forward to the JSP and the framework will automatically pre-select the
matching value.

Search the archives for 'prepopulate form' and you should find many posts
discussing this.

-- 
Wendy Smoak


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