Jump to content

Angelo_Z

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by Angelo_Z

  1. Thank you fot your reply,.

    I am sorry for the confusion. Excuse by bad English.

    Yes I  use PHP and I wish that the  previous selections  remines displayed on the form after pressed submit, I need to  show to the user which kind

     of 1st and 2nd selections he has done before, of course in te same session.

    For the 1st selection it was easy to to this,  but for 2 nd I have not find a solution.

    I hope to be more clear now.

    Thank you very much.

     

  2.  

    Hi, nobody has replied, maybe I have not been clear about what I need.

    for this input I have not problem, I resolve like this

    <select id="car" onchange="ChangeCarList()">
      <option value="">-- Car --</option>
      <option value="VO"  <?php if($car == 'VO')  {echo 'selected="selected"';}?>>Volvo</option>
      <option value="VW"  <?php if($car == 'VW')  {echo 'selected="selected"';}?>>Volkswagen</option>
      <option value="BMW" <?php if($car == 'BMW') {echo 'selected="selected"';}?>>BMW</option>
    </select>

     

    but I don't Know what to do  for this input

    <select id="carmodel"></select>

     

    I wait your replies

    Thanks

  3. Hi ! Please . I need to keep selected value in dropdown after submit, How I ca do it? Thanks in advance.

      <form name="passa" id="passa" >

    <select id="car" onchange="ChangeCarList()">
      <option value="">-- Car --</option>
      <option value="VO">Volvo</option>
      <option value="VW">Volkswagen</option>
      <option value="BMW">BMW</option>
    </select>

    <select id="carmodel"></select>

    <script>
    var carsAndModels = {};
    carsAndModels['VO'] = ['V70', 'XC60', 'XC90'];
    carsAndModels['VW'] = ['Golf', 'Polo', 'Scirocco', 'Touareg'];
    carsAndModels['BMW'] = ['M6', 'X5', 'Z3'];

    function ChangeCarList() {
      var carList = document.getElementById("car");
      var modelList = document.getElementById("carmodel");
      var selCar = carList.options[carList.selectedIndex].value;
      while (modelList.options.length) {
        modelList.remove(0);
      }
      var cars = carsAndModels[selCar];
      if (cars) {
        var i;
        for (i = 0; i < cars.length; i++) {
          var car = new Option(cars, i);
          modelList.options.add(car);
        }
      }
    }
    </script>

    <input type="submit" name="azione"   id="azione"  value="Submit">
    </form>

×
×
  • Create New...