473,225 Members | 308 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,225 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 16489
"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...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.