Question
Time: 15:49 - Oct 30, 2007 Asked by: kassidi6 Status: Answered Points: 75
i need help with enabling/disabling text fields
I looked at one your older posts and im currently using your following script: <html> <head> <title>Test</title> <script type="text/javascript"> function disable_controls( state) { var frm = document.forms[0] ; var len = frm.elements.length ; var cnt = 0 ; for ( var i=0; i < len; i++) { var elem = frm.elements[i] ; if (elem.type != "hidden") { elem.disabled = state ; } } } </script> </head> <body> <button onclick="disable_controls( false)">Enable</button> <button onclick="disable_controls( true)">Disable</button> <br> <form action="yours" method="POST" enctype="application/x-www-form-urlencoded"> <input name="t1" disabled size="10" value="ini val" type="text"> <br> <textarea name="t2" cols="10" disabled >abc def</textarea> </form> </body> </html> -------------------------------------------------------- The way i'm actually using it is instead of using buttons to disable/enable the following fields, i'm using a radio type field. Yes (is the Enable value) and No (Disable value). The problem i'm having is that when i a select No, it will gray out radio field. I can't then go back and select Yes. I tried tweaking the code a bit, but with no success. Is there a way to workaround this? Thank you very much.
Current Categories
Other Questions Needing Answers
Answer Discussion
Answer Summaries
Answer Summary
Advertisement
Expert:
kassidi6
Date:
Oct 30, 2007
Time:
16:05
Votes: Good (0) | Bad (0)Login to rate this answer
rcastagna
Nov 07, 2007
07:35
16:46
Question Answered
This question has been answered, and points have been rewarded to the following experts:
You're welcome however to comment or give additional information or if you wish, you have the ability to write an Answer Summary for this question by clicking on the "Answer Summaries" Tab.
Respond to this question:
New User
Email:
Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address
Registered User
Username:
Password:
Forgotten Password
Enter your email address below and we will resend your login information to you.
Login Information Sent
"Psst, Quomon is a great site. Pass it on." Tell a Friend | Link To Us | Save to Delicious | Digg it
All Questions
Language Options
English:
Español:
Quomon Blog
Sponsors
Questions and Answers Software Real Estate Postcards Marketing Fulfillment