Populating dropdown options..

View: New views
5 Messages — Rating Filter:   Alert me  

Populating dropdown options..

by JFriend :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
Iam new to ATG technology..

I want to populate the dropdown ie dsp:select options in my form with the values from the database.
For example sizes field with small, Medium & large which are in the db.

Another kind is::
I want to populate the dropdown with the enumerated field in the item descriptor of a repository definition file.
For example, the Gender field with male and female which are the options given for "gender" property(datatype is enumerated) in the repository definition file..
How to achieve these two types?
please help me..

Re: Populating dropdown options..

by Geeta :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

  We can populate the dropdown list by using dsp:select tag .
  We need to store all the values in a particular component.We can get the values from component as mentioned below.....
         

 Expiration Date:
  Month: <dsp:select bean="ExpressCheckoutFormHandler.paymentGroup.expirationMonth">
    <option value="1"/>January
    <option value="2"/>February
    <option value="3"/>March
    <option value="4"/>April
    <option value="5"/>May
    <option value="6"/>June
    <option value="7"/>July
    <option value="8"/>August
    <option value="9"/>September
    <option value="10"/>October
    <option value="11"/>November
    <option value="12"/>December
  </dsp:select>
  Year: <dsp:select bean="ExpressCheckoutFormHandler.paymentGroup.expirationYear">  
    <option value="2011"/>2011
    <option value="2003"/>2003
    <option value="2004"/>2004
    <option value="2005"/>2005
    <option value="2006"/>2006
    <option value="2007"/>2007
    <option value="2008"/>2008
    <option value="2009"/>2009
    <option value="2010"/>2010
  </dsp:select>
<p>  
.....................................................



Thanks & Regards
   Geetha

Re: Populating dropdown options..

by JFriend :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for ur help.
But actually what i want is, i want to populate the options in the dropdown from the repository definition file..

if the property in the file is
<property name="gender" column-name="gender" data-type="enumerated">
                <attribute name="useCodeForValue" value="false"/>
          <option value="Male" code="0"/>
          <option value="Female" code="1"/>
              </property>

then for the dropdown field "Gender" in the form, i want Male and Female as the options in the dropdown.
I already have a repository component which uses the above definition file.

Thanks in advance.

Re: Populating dropdown options..

by Geeta :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Please do find attachment for your problem..

Please let me know the solution for ur problem if it does solve ur problem.....







 New+Folder.zip
Thanks & Regards
   Geetha

Re: Populating dropdown options..

by JFriend :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank u very much.. i will check whether it will solve my problem..