• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to disable text input field and change color or text box?

 
Dennis Chen
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi gurus,
I have two radio buttons and under each radio button I have a few text input fields. I need to disable the text fields based on the radio option selection along with greying out the text area so as to let the user know that it is unavailble.
Any help is appreciated.
Thanks!!!
 
Chuck Meduri
Ranch Hand
Posts: 48
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That could be done in the following manner:
Assumptions: radio is the name of all the radio buttons
for(var i=0; i<document.formName.radio.length; i++)
{
if(document.formName.radio[i].checked="1" && document.formName.radio[i].value="firstRadioButton")
{
document.formName.textBoxName.disabled="true";
}
}
Hope that helps.
 
Dennis Chen
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. But I found a solution to it using <div> tags and onClick. The only problem I am having now is form validation on the input text fields between the <div>. Is there a way around it?
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
What is the problem, specifically?
 
Brian Glodde
Ranch Hand
Posts: 171
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's hard to say what's wrong without seeing any code, however most of the time you're having trouble reaching an element inside a div, it's the way you're calling through the DOM. Try using document.all['elementname'] for ie and document.layers['elementname'] and see if that gets you a reference.
 
xavier romea
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Normally, you can't dispath a form on several layers or div.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic