473,397 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Grey out or disable form?

Hi,

I have a table of questions (with radio buttons) that I want to appear
greyed out so that users can feel they can skip it and go on to the
next page. But if they should choose to answer the questions, I'd
want them to uncheck a checkbox so that the table would appear white.
How do I do this? (If I can also disable the radio buttons at the
same time, that would even be better.)

Also, I'd need it to work in both IE and Netscape/Mozilla.

Thanks for the help!

(And step-by-step coding would be GREATLY appreciated, as I'm a total
javascript newbie :)
Jul 23 '05 #1
1 16496
"J Belly" <me@privacy.net> skrev i meddelandet
news:0v********************************@4ax.com...
Hi,

I have a table of questions (with radio buttons) that I want to appear
greyed out so that users can feel they can skip it and go on to the
next page. But if they should choose to answer the questions, I'd
want them to uncheck a checkbox so that the table would appear white.
How do I do this? (If I can also disable the radio buttons at the
same time, that would even be better.)

Also, I'd need it to work in both IE and Netscape/Mozilla.

Thanks for the help!

(And step-by-step coding would be GREATLY appreciated, as I'm a total
javascript newbie :)


You can use the "disabled" attribute in HTML:
<input type="radio" name="somename" disabled>

....and set it in Javascript (looping a radio button array):
var radios = document.forms["someform"].elements["somename"];
for(var i = 0, max = radios.length; i < max; i++){
radios[i].disabled=1; //Or 0 for enabling it
}

For the table background and the text, you could create different CSS
classes and then do:

var thing = document.getElementById("someid");

if(thing)
thing.className="myGrayedOutCSSname";

Add an onclick handler to the checkbox that calls a function that takes
care of enabling/disabling:

<input type="checkbox" name="somename"
onclick="toggleTableState(this.checked);">

then in the <head>:

function toggleTableState(inEnable){

// Enable/disable radio buttons
// Set className of whatever it is that should look different
}
--
Joakim Braun

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Forti2ude | last post by:
Hello, I have a simple form... <form> <select name="foo" multiple> <option value="1">one</option> <option value="2">two</option> <option value="3">three</option> </select>
2
by: tottigang | last post by:
Hi, I have a tabstrip and I have some tabs in it. On the first page, all the tabs are enabled, I need to disbale part of the tabs at a specific point in the application and again enable them. I...
4
by: Chris | last post by:
I have an asp.net page say page1.aspx. The form in html code is <form id = "Form1"> And i want to disable all the fields of the form after some code steps. I had created a javascript funct: ...
5
by: acord | last post by:
Hi, Is there such thing that an item in the listbox is disabled and is appeared grey-out? How can I implement this in html/javascript? Thanks A
4
by: Patrick Flaherty | last post by:
Hi, Experienced programmer but new to PHP. Moreover I'm to use PHP with Xoops on top (this adds object orientation?). I don't seem to find a xoops Usenet group? Whatever the case (and...
0
by: Ahmad Jalil Qarshi | last post by:
Hi! I have a problem while developing some webpages.The Problem is that:- How We Can Disable The Controls Of One Web Form From Other Web Form In Asp.net? Explanation:- There Should Be Two...
3
by: BrendanMcPherson | last post by:
How can I get a listbox to change a textbox on some selections. I have a listbox which only needs to be filled in on some selections. Is there a way I can have on some selections the textbox go...
5
by: Kevin Wilcox | last post by:
In Access 2003 I have a continuous form with a combo. I'm trying to find a way to change the displayed values of the combo depending on whatever value was selected in the combo in the previous...
2
by: y2ktan | last post by:
Hi Guys and Girls, I am building a windows application using VS2005, C#.net. Now, I have a combo box that contains a collection of elements. Thus, I want to grey out some of the elements in the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.