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/29 20:39:02 UTC

preselect dropdown

 
 
Hello,
 
I have an edit.jsp where a user can edit message details.  So for example, if a message has a start date (day,month, year) these fields can be updated by user.
 
The problem is that I have dropdowns for month and day.  I would like it if the dropdown for month could be prepolutated with the value the user has allready saved before.  So for example it could be prepoluted with "February" and the user can select another value from the dropdown if he/she wishes to change it.
 
Any ideas/hints/code would be helpful,
thanks,
Anna

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


Re: preselect dropdown

Posted by Ron Grabowski <ro...@yahoo.com>.
> I usually do something like this:
> 
>  <html:select property="month">
>   <html:optionsCollection name="months" />
>  </html:select>


Whoops, "months" belongs to the ActionForm:

 <html:select property="month">
  <html:optionsCollection property="months" />
 </html:select>


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


Re: preselect dropdown

Posted by Ron Grabowski <ro...@yahoo.com>.
> The problem is that I have dropdowns for month and day.  I would like
> it if the dropdown for month could be prepolutated with the value the
> user has allready saved before.  So for example it could be
> prepoluted with "February" and the user can select another value from
> the dropdown if he/she wishes to change it.
>  
> Any ideas/hints/code would be helpful,

I usually do something like this:

 <html:select property="month">
  <html:optionsCollection name="months" />
 </html:select>

Where "month" is the selected month and "months" is a LabelValueBean[]
containing Jan, Feb, Mar, etc.

I have my Action class set the form's value for month so it is
pre-selected in the list.

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