0

I have a page where users enter certain information about a car in a database and then they have the possibility to edit this information from another "Edit" page. I would like to forbid the users from changing the Make and Model of the car on the Edit page but still to keep the originally selected values. I tried disabled="true" but upon editing the page, the values are not being remembered. Is there anther way to do it? readonly="true" seems not to do the job either.

Here is my code for the model field on the "Edit" page:

<select name="model" id="model" class="validate[required] text-input">        
                    <?php while(!$rs_models->EOF){?>
                        <option value="<?php echo $rs_models->fields['id'];?>" <?php     if($rs_models->fields['id']==$model_id){?> selected="selected"<?php }?>>
                            <?php echo $rs_models->fields['title'];?>
                        </option>
                    <?php $rs_models->MoveNext(); } ?>
                </select>
user3132858
  • 609
  • 1
  • 11
  • 27

2 Answers2

3

You need to put an attribute in option to disable dropdown but on certain condition like:

<option disabled >car</option>
Omair
  • 31
  • 2
  • It doesn't work. I can still select the dropdown, even if the options are greyed out. And the values are not remembered after saving the page, which is the initial problem. – user3132858 Dec 30 '13 at 20:48
0
  1. More clear Example of my previously provided suggestion could be like this. This will block a certain option in the select (drop down)

         <!DOCTYPE html>
         <html>
         <body>
    
         <select>
           <option value="car" disabled>Volvo</option>
           <option value="bike">Saab</option>
           <option value="truck">VW</option>
         </select>
    
         </body>
         </htm>
    
  2. If you want to block the whole select box (drop down) with your value (option) showing in it this could be the solution.

         <!DOCTYPE html>
         <html>
         <body>
    
         <select disabled>
           <option value="car">car</option>
         </select>
    
         </body>
         </html>
    
Omair
  • 31
  • 2