i need help with enabling/disabling text fields
I looked at one your older posts and im currently using your following script: ! Enable Disable
abcdef --------------------------------------------------------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.
Status:
Open Oct 30, 2007 - 12:51 PM
JavaScript
3answers
Answers
Oct 30, 2007 - 01:05 PM
oops, i forgot to mention that i changed the code of the html body to be as follow:------------------------------------------------------------------------
-------------------- Yes No
abcdef -------------------------------------------------------------------------------
---------------------------------The reason it's behaving the way i mentioned earlier is because i moved the radio field inside the form, which is how we want it to be.Any help on how to get it to work by having the radio field inside the form will be much appreciated.Thank you.
Nov 07, 2007 - 03:35 AM
kassid,
In your javascript, you're iterating through all the controls and disabling them, including your radio button. That's why it's giving you the behavior you're experiencing.
Basically, you're still going to iterate all the controls in the form, but when you get to your radio button(s), you're going to leave them enabled by ignoring them...
if (elem.type != "hidden") {
if (elem.type != "radio") {
elem.disabled = state ;
}
}
That will keep all radio buttons enabled. You can refine it by looking at the name or adding an id property and excluding the radio button(s) programmatically.
I hope this helps,
Ric
Nov 07, 2007 - 12:46 PM
missed that. works out fine now. Thank you.
Answer this question
Share Your Own Experience & Expertise
We look to ensure that every question is answered by the best people with relevant expertise and experience, the best answers include multiple perspectives. Do you have relevant expertise or experience to contribute your answer to any of these commonly asked questions?
Add New Comment