PHP Classes

Selected items

Recommend this page to a friend!

      Cascade Dropdown 3 Levels  >  All threads  >  Selected items  >  (Un) Subscribe thread alerts  
Subject:Selected items
Summary:How to set selected to the cascade for update?
Messages:5
Author:Petr Pohl
Date:2006-02-06 10:43:24
Update:2006-02-06 13:43:17
 

  1. Selected items   Reply   Report abuse  
Picture of Petr Pohl Petr Pohl - 2006-02-06 10:43:24
A usefull class, but I need to set type, brand to listboxes in the cascade for update purposes. The first - type - is not a problem, but when I would to set selected for the second - brand, thats a problem. Please could you help me or update the class. Thank you.

  2. Re: Selected items   Reply   Report abuse  
Picture of Gobinath Mallaiyan Gobinath Mallaiyan - 2006-02-06 11:31:47 - In reply to message 1 from Petr Pohl
You can pass the value which is stored in the db to the function which is generating the Dropdown and with the simple if condition you can make the selection

  3. Re: Selected items   Reply   Report abuse  
Picture of Petr Pohl Petr Pohl - 2006-02-06 12:27:45 - In reply to message 2 from Gobinath Mallaiyan
And where should i put the "selected", there is only one option in the html code...

//Brand List Box Creation
echo "<select name=\"brand\" onChange='changeModel(this)' disabled >\r";
echo "<option value='--Select--'>--Select--</option>\r";
echo "</select>";

so the other way is javascript, somehing like this

new Option('--Select-- selected','--Select--');

can you please tell me where should I put the if condition. Thank you.

  4. Re: Selected items   Reply   Report abuse  
Picture of Gobinath Mallaiyan Gobinath Mallaiyan - 2006-02-06 12:38:48 - In reply to message 3 from Petr Pohl
you can add it like this

if (condition == true){
echo "<option value='--Select--' selected>--Select--</option>\r";
}
else{
echo "<option value='--Select--'>--Select--</option>\r";
}

  5. Re: Selected items   Reply   Report abuse  
Picture of Petr Pohl Petr Pohl - 2006-02-06 13:43:17 - In reply to message 4 from Gobinath Mallaiyan
Only for TYPE it's easy, bud I would like to set both options onload - main TYPE and sub BRAND. How to set selected BRAND and show the other options for the selected TYPE in the BRAND? I don't know how to deal with it :-(

//TYPE List Box Creation
echo "Type <select name=\"type\" size=\"1\" onChange='changeBrand(this)'>\r";
echo "<option value='--Select--'>--Select--</option>\r";
for($i=0;$i<count($this->arrType);$i++){
echo "<option value='".$this->arrType[$i][0]."'>".$this->arrType[$i][1]."</option>\r";
}
echo "</select> &nbsp; Brand&nbsp;";

//Brand List Box Creation
echo "<select name=\"brand\" onChange='changeModel(this)' disabled >\r";
echo "<option value='--Select--'>--Select--</option>\r";
echo "</select> &nbsp; Model&nbsp;";