CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Jan 2009

    Arrow OnChange Filter To First Value Request

    I am running a php & java script that when searching for a property, it uses the onchange feature for three fields regarding the location of the property.
    for example: Country, Parish, Area

    When you choose a country, you then choose a Parish(which correspons to the country) and then an Area (that corresponds to the Parish)

    Thing is, I am only using one country and would like the script to automatically show/filter to that country rather than 'Any'. For example I would want the Country field to show United Kingdom as a default.

    Here is a link to a screenshot of how it looks now:

    And here is a segment of the code from the php file that it uses to change the fields

     <form action="<?php echo URL ?>/search.php" method="POST" name="form">
    <?php echo $lang['WHERE']; ?>:</h2>
    <?php echo $lang['Location1'] ?> <br>
    <select name="location1" class="span3" onchange="update(this, locations);">
    <?php echo $lang['Location2'] ?> <br>
    <select name="location2" class="span3" onChange="update(this, locations);">
    <?php echo $lang['Location3'] ?> <br>
    <select name="location3" class="span3">
    <input type="hidden" name="form" value="1">
    <input type="hidden" name="loc" value="">
    What i want is to filter to first value(United Kingdom) by default in the dropdown (location1)
    I checked on the net and it was suggested to have another javascript running after the listbox using selectedIndex=1 but I'm not sure how to implement it.

    Any help would be greatly appreciated
    Last edited by PeejAvery; January 11th, 2009 at 07:23 PM.

Tags for this Thread

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.