Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Form Dependency Script

  1. #1
    Join Date
    Aug 2008
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default 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?

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Hm... in what browser is this occurring?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Aug 2008
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    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.

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    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.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. The Following User Says Thank You to Twey For This Useful Post:

    KyleT4L (08-26-2008)

  6. #5
    Join Date
    Aug 2008
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thank you. I do believe that worked, sir.

  7. #6
    Join Date
    Aug 2008
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    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.

  8. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    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;
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #8
    Join Date
    Aug 2008
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    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?

  10. #9
    Join Date
    Aug 2008
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Is there nothing else that can be done?

  11. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You broke it by inserting the else this.value = "";from before as well. Remove that.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •