Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Auto drop down box

    I am trying to create 2 drop down boxes, for example Country and state so when country is selected it will show in the second drop down box the correct list of states.

    I know how to do it with an if command in the second box but it requires a form to be submit but because it is already a form, how would I make a form inside a form work?

    Thanks

  • #2
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    If you want a hidden dropdown to without a page load, you will have to look into a javascript solution. This can't be done with php.

  • #3
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ?

    Dont mind page load I just don't know how to do it because its already in a form how would you do it?

  • #4
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    I don't see a php-based solution as being very intuitive. You wouldn't need a form inside a form, but rather the user would submit the form with the country selected, you would then redisplay the page (or another page) with the state dropdown included, and the user would resubmit the form.

  • #5
    New Coder
    Join Date
    Jul 2007
    Location
    Masai, Johor, Malaysia
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i think you can do it like this and this is how i have done..

    <th colspan="4" scope="col"><select name="select" id="select" >
    <option value="value" value="value"<?php if (!(strcmp("value", $_SESSION['KT_eDept']))) {echo "SELECTED";} ?> <?php if (!(strcmp("value", $_SESSION['KT_eDept']))) {echo "SELECTED";} ?>>
    Select Dept...
    </option><?php
    while(!$rs_section->EOF){
    ?>
    <option value="<?php echo $rs_section->Fields('DEPT_NAME')?>"<?php if (!(strcmp($rs_section->Fields('DEPT_NAME'), $_SESSION['KT_eDept']))) {echo "SELECTED";} ?>><?php echo $rs_section->Fields('DEPT_NAME')?></option>
    <?php
    $rs_section->MoveNext();
    }
    $rs_section->MoveFirst();
    ?>
    </select>
    <select name="select2" id="select2" wdg:subtype="DependentDropdown" wdg:type="widget" wdg:recordset="rs_section2" wdg:displayfield="SECTION" wdg:valuefield="SECTION" wdg:fkey="DEPT_NAME" wdg:triggerobject="select">
    <option>Select Section...</option>
    </select></th>
    </tr>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •