-
Form Dependency Script
Hello, all!
This is the script: http://www.dynamicdrive.com/dynamici...dependency.htm
Okay, this problem could either be javascript related or HTML related. Maybe a bit of both.
I am using the form dependancy script created by Twey, and it works great. Only problem is, I can't seem to get the SELECTED option working for dropdown menus, which is kind of annoying.
HTML can be found here: www.training4life.org/file.htm
For example, if you click BLS at the top, new dropdown menus appear.
But they're blank.
You have to physically click them and select an item. I would rather that a 'standard' item be automatically selected when they appear.
Like a regular dropdown menu WITHOUT the javascript, you can use the SELECTED option to show which item will show up first on the dropdown (without clicking it), or otherwise the first item will appear first.
For some reason with this script that is no longer true.
Anyone (Twey perhaps?) have any ideas?
-
Hm... in what browser is this occurring?
-
Hello, sir!
Internet Explorer. The newest version, I'd wager, since I'm using Vista. Not quite sure how to check version on Vista yet. Definitely internet explorer, though.
-
Peculiar. The script does not explicitly reset the value of... ah!
Remove the two lines
Code:
if(typeof this.checked !== "undefined") this.checked = false;
else this.value = "";
and see if this fixes your issue.
-
Thank you. I do believe that worked, sir.
-
Of course, now something new arises--isn't that always the way?
It seems like I'll have to deal without the options being selected.
If you enjoy puzzles you may enjoy this.
When I remove the lines you outlined, my problem with the standard selections go away. But, if I send the information out as an e-mail (the point of the form) every option is populated into the e-mail, as opposed to just the one selected.
It's like a catch 22.
I thought I'd share that with you, in case you had any thoughts.
-
Where those two lines were, try inserting the single line:
Code:
this.disabled = true;
Also, to make sure they don't stay disabled, find these lines:
Code:
var showEl = function() {
this.style.display = "";
and insert after them:
Code:
this.disabled = false;
-
Thank you for continuing to help.
I did as you instructed, and as you can see from the link above, now everything is automatically selected.
Did I do something wrong somehow?
-
Is there nothing else that can be done?
-
You broke it by inserting the else this.value = "";from before as well. Remove that.
-
You, sir, are a champion.
Thank you for all your expertise and patience.
- Kyle