Parent and Child Dropdown loading

Hi,

 

I have two dropdowns Country and State.

 

When loading the form, i set the first value(Country Values - e.g US) to Parent dropdown.

 

I want to set the first value(State Values - e.g NY) to State dropdown based on the Parent DDL value in same form load.

 

Any Ideas?

Tagged:

Comments

  • I am not sure I am reading you right, but if what you are trying to do is to have the State dropdown list change based on the Selected Country then you can code it on the Country Change request.

     

    Add an additional local variable like memSQL to the form:

     

    On form load set this value to a base value as to prevent it from failing later:

     

    Oracle

    Local.memSQL = "select '' from where rownum = 1";

     

    MSSQL

    Local.memSQL = "select top 1 '' from ";

     

    Set the Country drop down to has Dependents

    Set the State drop down to is Dependent

     

    On the Country Drop Down ON CHANGE event set the memSQL value as such

     

    memSQL= "Select States from StateTable where StateCountry = '" + Local.CountryDropDown + "'"

     

    Change the List options for the State Drop Down as follows:

     

    SelectSql(new MetastormDefault(), Local.memSQL)

     

     

    Now the State Drop down will load blank on form load

    and then every time you select a country the State list will adjust itself based on the selected country.