By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,921 Members | 1,479 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,921 IT Pros & Developers. It's quick & easy.

Only allow selection from select list when radio button clicked

100+
P: 254
Hi

I have a html in which there is two selection box and two radio button. Radio buttion is of array type.

What I want if user will click the radio button then only he/she be able to make selection from select list. Initially I tried to disble the selection control. And when user will click the radio then only it was enabled. but I faced problem that value is not passed to the next form of the select list. so I enable the select list now it is working. but I want selection made only possible when user clicks the radio button.
Jan 25 '08 #1
Share this Question
Share on Google+
10 Replies


acoder
Expert Mod 15k+
P: 16,027
Please remember to provide a meaningful Title for any threads started (see the FAQ entry Use a Good Thread Title).

This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions.

Moderator.
Jan 25 '08 #2

acoder
Expert Mod 15k+
P: 16,027
I have a html in which there is two selection box and two radio button. Radio buttion is of array type.

What I want if user will click the radio button then only he/she be able to make selection from select list. Initially I tried to disble the selection control. And when user will click the radio then only it was enabled. but I faced problem that value is not passed to the next form of the select list. so I enable the select list now it is working. but I want selection made only possible when user clicks the radio button.
Instead of disabling the select element, set it to readonly.
Jan 25 '08 #3

100+
P: 254
Instead of disabling the select element, set it to readonly.
Sorry for that!
I have given the html format of the page. I want selection made only possible if user selects first any of the radio buttion then he may able to select the from any select. Means If he clicks radio value having Static then User will select page from Static1 select if he checks radio with value Dynamic then he will select from Dynamic Select.

Expand|Select|Wrap|Line Numbers
  1.  html
  2. <input type="radio" value="Static" name="Static"  />
  3. <select name="Static1" id="select">
  4.         <option>Select Static Page </option>
  5.         <option>page 1</option>
  6. <option>page 2 </option>
  7.  
  8.             </select>
  9. <input type="radio" value="Static" name="Static"  />
  10. <select name="Dynamic" id="select" ">
  11.         <option>Select Static Page </option>
  12.         <option>page 1</option>
  13. <option>page 2 </option>
  14.  
  15.             </select>
Jan 25 '08 #4

acoder
Expert Mod 15k+
P: 16,027
Instead of disabling the select element, set it to readonly.
Ignore this. I don't think the select element has a readOnly property.

What you can do is onsubmit re-enable the select elements.
Jan 25 '08 #5

100+
P: 254
Ignore this. I don't think the select element has a readOnly property.

What you can do is onsubmit re-enable the select elements.
I tried to reenble the select onsubmit but its value is not going next in php.
Jan 28 '08 #6

acoder
Expert Mod 15k+
P: 16,027
I tried to reenble the select onsubmit but its value is not going next in php.
Can you show the code that you tried.
Jan 28 '08 #7

100+
P: 254
Can you show the code that you tried.
The problem is solved now.
Jan 29 '08 #8

acoder
Expert Mod 15k+
P: 16,027
The problem is solved now.
Glad you managed to solve it. For the benefit of anyone else who comes across this thread, can you tell us what the problem/solution was.
Jan 29 '08 #9

100+
P: 254
Glad you managed to solve it. For the benefit of anyone else who comes across this thread, can you tell us what the problem/solution was.
Actually option's value was empty. then I assign some value to it.
Expand|Select|Wrap|Line Numbers
  1.  
  2. <select>
  3. <option value="Page1">Page1</option>
  4. </select>
Jan 30 '08 #10

acoder
Expert Mod 15k+
P: 16,027
Actually option's value was empty. then I assign some value to it.
Thanks. Hopefully, it'll help someone with a similar problem.
Jan 30 '08 #11

Post your reply

Sign in to post your reply or Sign up for a free account.