473,322 Members | 1,562 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,322 software developers and data experts.

Using JavaScript to shade form fields

I am looking to use an HTML checkbox feature as a trigger to
shade/unshade a multiple select field in an HTML form. For instance:
there are four options in the multiple select field and one outside of
it. Is there a simple way, using JavaScript, so that if the outside
option is selected, or "checked", the multiple select field will be
shaded (unusable) and if it's deselected, or "unchecked", the multiple
select field will be unshaded (usable)? Also, if the outside field is
checked, it's value should be written upon submittal.

Thanks in advance!
Jul 23 '05 #1
2 3342
You'll probably have to do this with CSS as well as Javascript. check out

"Mike N." wrote:
I am looking to use an HTML checkbox feature as a trigger to
shade/unshade a multiple select field in an HTML form. For instance:
there are four options in the multiple select field and one outside of
it. Is there a simple way, using JavaScript, so that if the outside
option is selected, or "checked", the multiple select field will be
shaded (unusable) and if it's deselected, or "unchecked", the multiple
select field will be unshaded (usable)? Also, if the outside field is
checked, it's value should be written upon submittal.

Thanks in advance!


Jul 23 '05 #2
I received the following in an e-mail. This code worked perfectly.

------------------------------------------------------------

Hi Mike,
You need to use "form.object.disabled=true/false"
I've written all the code you need below.

Best wishes

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="JavaScript" type="text/javascript">
function shade(){
if(document.testform.status.checked==true){documen t.testform.content.disable
d=true}
else{document.testform.content.disabled=false}
}
</script>

</head>
<body>
I think what you're looking for is "form.object.disabled=true/false"<br><br>
<form name="testform">
<input type="checkbox" name="status" checked onClick="shade()">Disabled
when checked<br>
<input type="text" name="content" size="40" value="Disabled - UnCheck to
Enable" maxlength="40" disabled>
</form>
(Mike N.) wrote in message news:<17**************************@posting.google. com>...
I am looking to use an HTML checkbox feature as a trigger to
shade/unshade a multiple select field in an HTML form. For instance:
there are four options in the multiple select field and one outside of
it. Is there a simple way, using JavaScript, so that if the outside
option is selected, or "checked", the multiple select field will be
shaded (unusable) and if it's deselected, or "unchecked", the multiple
select field will be unshaded (usable)? Also, if the outside field is
checked, it's value should be written upon submittal.

Thanks in advance!

Jul 23 '05 #3

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

Similar topics

9
by: Randell D. | last post by:
Folks, I can program fairly comfortably in PHP and can, for the most part using these skills and others that I've picked up over the years manage to read/understand most code in Javascript... so...
1
by: sman | last post by:
Hi, I recently read this article on About.com on how to create required fields for a form: http://javascript.about.com/library/scripts/blformvalidate.htm Everything works great except that there...
10
by: DettCom | last post by:
Hello, I would like to be able to display or hide fields based on whether a specific Yes/No radio button is selected. This is in conjunction with a posting a just made here in the same group...
8
by: Ed Jay | last post by:
I want to use history.go() to navigate between my previously loaded pages. I'm looking for a way to trigger a function call when a page is accessed using history.go(). Is there an event generated?...
9
by: Kevin Blount | last post by:
Here's the code I tried, and found it failed... <form runat="server" method="post" name="CreditCardForm" id="CreditCardForm"> <% foreach (object item in Request.Form) { if...
3
by: anthonybrough | last post by:
I have an asp page that has a form to collect user data in a form. when the user clicks submit the input is validated. If any fields are not acceptable the user clicks on a button to go back to...
3
by: The Natural Philosopher | last post by:
Ok, I have another form to write, and one of its features will be pop up or drop down select-from-list stuff. Could be done with javascript, could be done with <SELECT> <OPTIONetc etc.. It...
35
by: Dan Rumney | last post by:
Hi all, I've been writing Javascript for quite a while now and have, of late, been writing quite a lot of AJAX and AJAX-related code. In the main, my dynamically generated pages are created...
2
by: zufie | last post by:
I must combine the information from two forms/tabs on a main form. The idea is to insert two checkboxes on the main form. Then based on the checkbox checked would then automatically highlight...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.