I have multiple select boxes, say: ID, RollNo, Name and class.
If ID is set ,I want to reset the RollNo, name and class to nothing or blank.
My web page
<?php echo $this->Form->input('id',
array("options"=>$databaseFields->getOptions("id",1))); ?>
<?php echo $this->Form->input('RollNo',
array("options"=>$databaseFields->getOptions("rollno",1))); ?>
<?php echo $this->Form->input('name',
array("options"=>$databaseFields->getOptions("name",1))); ?>
<?php echo $this->Form->input('class',
array("options"=>$databaseFields->getOptions("class",1))); ?>
You can achieve this easily using jQuery. Since we don’t have much information about your HTML I present a more generalized solution.
Add the following to your
<head>:(or download the .js file and point to it’s local path)
Then add something along these lines also on the
<head>of your document:You can see a working example at http://jsfiddle.net/zPhnN/1/
This should be modified to suit your needs, but hopefully it’s something to get you started.