IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New .bgcolor="#ffffff" ?
I'm not really sure what you're asking here...
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Re: .bgcolor="#ffffff" ?
How can I change the background color from white to gray for the textboxes that should not be available to the user, based upon which radio button the user selects?

I've tried:

  • document.getElementById("txtDateFrom").reset() --> that doesn't work
  • document.getElementById("myForm").reset() --> that doesn't work. In fact, it loses track of the radio button value that the user selected.
  • window.location.reload() --> ditto.


In ASP.Net, you can design your page with a Radio Button List and set the AutoPostBack property to "True"; it's a communal property to the list, not a singular radio button. Thus, when a user clicks on a radio button, the page re-posts itself, keeping track of the radio button selected and allowing you to verify which one was selected. That way, I can disable and change the background color of the irrelevant text boxes whenever the user selects a button. They can select radio buttons all day, and the screen will re-post all day, until they finally click on the "Create Report" button that goes to the database with the filter criteria values taken from the textboxes to use in the WHERE clause of the SELECT statement. I don't want the user to fill in textboxes that have no relevance to the table(s) they will query and then bitch when the data displayed doesn't include all of the filter criteria they've selected.

The group of radio buttons that I've created are in HTML, with labels separating groups of button choices. So the AutoPostBack capability isn't there.
lincoln

"Chicago to my mind was the only place to be. ... I above all liked the city because it was filled with people all a-bustle, and the clatter of hooves and carriages, and with delivery wagons and drays and peddlers and the boom and clank of freight trains. And when those black clouds came sailing in from the west, pouring thunderstorms upon us so that you couldn't hear the cries or curses of humankind, I liked that best of all. Chicago could stand up to the worst God had to offer. I understood why it was built--a place for trade, of course, with railroads and ships and so on, but mostly to give all of us a magnitude of defiance that is not provided by one house on the plains. And the plains is where those storms come from." -- E.L. Doctorow


Never apply a Star Trek solution to a Babylon 5 problem.


I am not merely a "consumer" or a "taxpayer". I am a Citizen of the United States.


[link|mailto:bconnors@ev1.net|contact me]
New Re: .bgcolor="#ffffff" ?
You already posted the code...

Get the radio button element. Set element.disabled to true and element.style.backgroundColor to some grey color. To make them usable again do the reverse.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Thanks, Scott - that worked
Sadly enough, the website that I am using to learn Javascript had the property as "bgColor", NOT "backgroundColor" and it did not mention the intermediate property of "Style".
lincoln

"Chicago to my mind was the only place to be. ... I above all liked the city because it was filled with people all a-bustle, and the clatter of hooves and carriages, and with delivery wagons and drays and peddlers and the boom and clank of freight trains. And when those black clouds came sailing in from the west, pouring thunderstorms upon us so that you couldn't hear the cries or curses of humankind, I liked that best of all. Chicago could stand up to the worst God had to offer. I understood why it was built--a place for trade, of course, with railroads and ships and so on, but mostly to give all of us a magnitude of defiance that is not provided by one house on the plains. And the plains is where those storms come from." -- E.L. Doctorow


Never apply a Star Trek solution to a Babylon 5 problem.


I am not merely a "consumer" or a "taxpayer". I am a Citizen of the United States.


[link|mailto:bconnors@ev1.net|contact me]
New That's the old property.
'style' manipulates the runtime CSS properties of the DOM element.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New You don't really have to worry about it
Both fore and background colors change automatically when you change the value of .disabled. Toggling that flag is all you really need to do. And with the onchange event of the radio buttons, it happens immediately, no refreshes needed.


(Caveat: on Firefox it does, no IE to test on my home PC, but I'm fairly certain the recent ones behave decently here)
New Sometimes you do
In particular you do in cases where someone has written JavaScript (or HTML) that explicitly sets the colours of the textboxes based on whether they should be disabled. :-P

Cheers,
Ben
I have come to believe that idealism without discipline is a quick road to disaster, while discipline without idealism is pointless. -- Aaron Ward (my brother)
New It didn't do it today
We use IE 6 at work.

The code to disable the textboxes worked - when I tried to click in them and enter a value, it wouldn't let me.

HOWEVER...

The textboxes had no values in them; when the page loads all of the textboxes start with white backgrounds. After certain boxes were disabled, the white background remained. I really want to darken the background so that the user KNOWS that they can't enter something into that text box.

I'll try admin's suggestion tomorrow morning.
lincoln

"Chicago to my mind was the only place to be. ... I above all liked the city because it was filled with people all a-bustle, and the clatter of hooves and carriages, and with delivery wagons and drays and peddlers and the boom and clank of freight trains. And when those black clouds came sailing in from the west, pouring thunderstorms upon us so that you couldn't hear the cries or curses of humankind, I liked that best of all. Chicago could stand up to the worst God had to offer. I understood why it was built--a place for trade, of course, with railroads and ships and so on, but mostly to give all of us a magnitude of defiance that is not provided by one house on the plains. And the plains is where those storms come from." -- E.L. Doctorow


Never apply a Star Trek solution to a Babylon 5 problem.


I am not merely a "consumer" or a "taxpayer". I am a Citizen of the United States.


[link|mailto:bconnors@ev1.net|contact me]
New Leave it to Billy...
Give IE the benefit of the doubt and it bites your head off.

The methods mentioned above are it but IE doesn't react until you click another button. If you set two radio buttons up as a toggle switch, you can see the text box change state and color but 180\ufffd out of phase :/
New Re: Leave it to Billy...
I had 2 issues come up with my side job that work great in browsers other than IE - using images as form input buttons and using PNGs with alpha channel. I'm using PHP for this project.

Each button originally had the same name, Option, and I'd do switch/case on $_POST['Option']. Turns out IE doesn't return $_POST['Option'], but it does return $_POST['Option_x'] and $_POST['Option_y'] for the x-y coordinates the user clicked on the image at. I ended up redoing the image buttons to have a name that starts with Option and check for anything staring with Option to retrieve the user's input from the _x or _y value as such:
\n$UserInput = $_POST['Option'];\n  if ($UserInput == "")\n  {\n        foreach($_POST as $key => $value)\n                if (substr($key,0,6) == "Option")\n                        $UserInput = str_replace("_",".",substr($key,6));\n        if (substr($UserInput,-2) == ".x" || substr($UserInput,-2) == ".y")\n                $UserInput = substr($UserInput,0,strlen($UserInput)-2);\n  }\n  switch($UserInput)\n  {\n   ....\n  }\n


I found [link|http://homepage.ntlworld.com/bobosola/index.htm|this site] with a [link|http://homepage.ntlworld.com/bobosola/imagemap.htm|work around] for the PNGs used as inputs in a form.

Note: the str_replace is because I have a "document folder" page that shows clickable icons to view files such as VacationRequest.pdf; the periods in the filenames get changed to _ so I have to change them back before I can display the files.
Darrell Spice, Jr.            Trendy yet complex\nPeople seek me out - though they're not sure why\n[link|http://spiceware.org/gallery/ArtisticOverpass|Artistic Overpass]                      [link|http://www.spiceware.org/|SpiceWare]
     Trying to do this in Javascript - (lincoln) - (12)
         .disabled = false; -NT - (admin) - (11)
             But what about the color change? -NT - (lincoln) - (10)
                 .bgcolor="#ffffff" ? - (admin) - (9)
                     Re: .bgcolor="#ffffff" ? - (lincoln) - (8)
                         Re: .bgcolor="#ffffff" ? - (admin) - (2)
                             Thanks, Scott - that worked - (lincoln) - (1)
                                 That's the old property. - (admin)
                         You don't really have to worry about it - (scoenye) - (4)
                             Sometimes you do - (ben_tilly)
                             It didn't do it today - (lincoln) - (2)
                                 Leave it to Billy... - (scoenye) - (1)
                                     Re: Leave it to Billy... - (SpiceWare)

Brought to you by the Tennessee Valley Authority!
71 ms