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

Anyone, HELP! - Graying Disabled fields after Back.

I hope someone can help here.
I'm creating a form that disables certain fields depending on the users
choices. But I've noticed that Disabled fields aren't "grayed out" (ie: you
can't tell they're disabled until you try to select them. Very annoying).

So I added code to manually change the background color of these fields
when a particular option is selected. Problem is, if they use their Back
button to return (like after a bad Submit), the normal white color returns
(even though they're still disabled).

The "Back" button doesn't trip an "onLoad" event, so I can't add code to
correct the colors manually.

Is there a way to "fix" the Disabled property so that disabled fields are
automatically grayed out even after clicking "Back"?

PS: Disabling "Back" and forcing the user to reload the page is not an
option because it wipes all all their prior entires and forces them to
start over. I don't want to do that.

Thanks in advance.

--
-*- Bubba -*-
Jan 27 '06 #1
3 1412
Bubba Gump wrote on 27 jan 2006 in comp.lang.javascript:
I'm creating a form that disables certain fields depending on the
users
choices. But I've noticed that Disabled fields aren't "grayed out"
(ie: you can't tell they're disabled until you try to select them.
Very annoying).


What do you mean by "fields" in the HTML sense?

I only know them in the Database record sense.
[and in the grazy sense]

Do you mean buttons?

Or <input type='text'>?

=============

If you mean the latter:
<form onsubmit='doGray();'>
<input name='field1' id='f' type='text'>
</form>

<script type="text/javascript">
function doGray(){
var f = document.getElementById('f');
f.enabled = false;
f.style.backgroundColor='gray';
}
</script>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 27 '06 #2
"Evertjan." <ex**************@interxnl.net> wrote in
news:Xn********************@194.109.133.242:
Bubba Gump wrote on 27 jan 2006 in comp.lang.javascript:
I'm creating a form that disables certain fields depending on the
users
choices. But I've noticed that Disabled fields aren't "grayed out"
(ie: you can't tell they're disabled until you try to select them.
Very annoying).
What do you mean by "fields" in the HTML sense?

I only know them in the Database record sense.
[and in the grazy sense]

Do you mean buttons?

Or <input type='text'>?


Hi Evertjan, thanks for the fast reply, but you've only given me what I
already have.
I'm manually changing the background color of input objects (typically
text boxes) that I disable, but if you leave the page and return using your
browsers Back button or javascript:go.history(-1);, the colors reset back
to normal.

I already know how to change the color. Now I want them to stay that way.
If you mean the latter:

<form onsubmit='doGray();'>


-*- Bubba -*-
Jan 27 '06 #3
Bubba Gump wrote on 27 jan 2006 in comp.lang.javascript:
Hi Evertjan, thanks for the fast reply, but you've only given me what
I already have.
I'm manually changing the background color of input objects
(typically
text boxes) that I disable, but if you leave the page and return using
your browsers Back button or javascript:go.history(-1);, the colors
reset back to normal.

I already know how to change the color. Now I want them to stay that
way.


That is impossible, since the page is restarted. This is a recurring Q here
that people would like the back-function to work differently from what it
actually does.

There are two options:
1 persist in trying to have is work like you want.
2 try a different approach of your concept.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 27 '06 #4

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

Similar topics

14
by: vic | last post by:
My manager wants me to develop a search program, that would work like they have it at edorado.com. She made up her requirements after having compared how search works at different websites, like...
6
by: Kartik | last post by:
Hello, I was trying to develop a game in c++ ( text mode ), but I couldn't figure out how to make rest of the elements moving in the game while waiting for the player's input, or, how to accept...
2
by: pratchaya | last post by:
This is my sample error in my MySQL Log New value of fp=(nil) failed sanity check, terminating stack trace! Please read http://www.mysql.com/doc/en/Using_stack_trace.html and follow instructions...
1
by: Lauren Wilson | last post by:
I'm having trouble with the Access VBA help on my installation of A2K with Dev tools. Every time I try to retrieve help for items listed in the Object Browser (and SOME other items as well),...
2
by: Brent Taylor via AccessMonster.com | last post by:
HELP----DOES ANYONE HAVE A SIMPLE .mdb for MLM structure? Does anyone have an example database for multi-level marketing for a 3 Tier setup? Thank you, brenttaylor@actionimports.net
8
by: CM | last post by:
Hi, Could anyone please help me? I am completing my Master's Degree and need to reproduce a Webpage in Word. Aspects of the page are lost and some of the text goes. I would really appreciate it....
6
by: placid | last post by:
Hi all, I'm looking for anyone who is working on a project at the moment that needs help (volunteer). The last project i worked on personally was screen-scraping MySpace profiles (read more at...
6
by: theintrepidfox | last post by:
Dear Group I've installed MSSQL 2005 STD on Vista and now can't attach my databases. I've installed SQL SP2 and the SQL Vista Beta Update. The error I'm getting is: Unable to open the...
11
by: Ken Fine | last post by:
I am using VS.NET 2008 and like it a lot. One of the very few things I don't like is a bug that seems to spawn literally thousands of   strings, one after the other, on design view changes....
0
by: canadianbacon | last post by:
Hi, I don't even know if this is the right place to post this but i will, because I need help. I'm trying to finish this basic game. but I am having troubles. If anyone wants to help me out it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.