#1
  1. GIRL POWER!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Posts
    235
    Rep Power
    0

    Question Help Disabling A Form Element w/o Reloading Page


    Here's my HTML code:
    PHP Code:
    <FORM NAME='sale' ACTION='doggiepage.php' METHOD='post'>
    <
    INPUT TYPE='radio' NAME='yes_or_no' VALUE='yes'>Yes
    <INPUT TYPE='radio' NAME='yes_or_no' VALUE='no'>No
    <BR><INPUT TYPE='text' NAME='sale_price' MAXLENGTH='5' SIZE='10'DP
    <BR><INPUT TYPE='submit' VALUE='Submit'>
    </
    FORM
    I want <INPUT TYPE='text' NAME='sale_price' MAXLENGTH='5' SIZE='10'>" to be disabled (grayed out) if "no" is selected, and enabled if "yes' is selected and I want the change to take affect immediately when a new value is selected (meaning without having to reload the page).

    How do I do this?

    Comments on this post

    • Skipt agrees
  2. #2
  3. c0der
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2005
    Location
    Vancouver
    Posts
    664
    Rep Power
    159
    This can be accomplished through a combination of:

    • Simple event handlers
      • onclick
      • onchange
    • The DOM
      • Object accessors
        • document.forms["FormName"].elements["ElementName"]
        • document.getElementById
      • element.disabled = true;
      • element.setAttribute("disabled", true);


    It's fairly basic. By Googling some terms mined from the above list (and doing a little reading) I'm sure you'll manage. After you've got a bit of code rolled out, drop by. We're here to help--but we won't do (home)?work for you.

    Comments on this post

    • dotancohen agrees : All the tools, all lined up.
    • codergeek42 agrees
  4. #3
  5. GIRL POWER!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Posts
    235
    Rep Power
    0
    Sir you have no idea how much I study. I have in fact researched this already and come up empty handed.....I am still more or less clueless how to write a JavaScript for this. (I am an HTML, CSS, and PHP person) I am tired, have a headache, and just want to get this done. Is that so much to ask? If so then get out whatever hateful things you want to say and then LEAVE ME ALONE. Sheesh!

    Oh yes, and one more thing....I don't know why so many people assume this but IT'S NOT HOMEWORK. I'm not even in school. I graduated in 2003 o.0

    Comments on this post

    • Joseph Taylor disagrees : Hateful? I gave you a list of terms, and recommended you do a little digging around on your own. You want us to do it for you though. No dice.
    Last edited by evenstar7139; June 4th, 2006 at 07:37 PM. Reason: Fixed Typos
  6. #4
  7. Cunning Linguist
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2003
    Location
    I used to live at home, now I stay at the house
    Posts
    10,166
    Rep Power
    2042
    Originally Posted by evenstar7139
    I have in fact researched this already and come up empty handed
    Sorry, but I find this very hard to believe.

    Just how tightly did you have your eyes shut while you searched
    Google for help?


    Originally Posted by evenstar
    Is that so much to ask? If so then get out whatever hateful things you want to say and then LEAVE ME ALONE. Sheesh!
    What hateful things? I see nothing wrong with Joseph's reply - he
    has provided you with more than enough ammo to get the job done.

    Don't bite the hand that feeds you.
    Last edited by ChiefWigs1982; June 4th, 2006 at 07:42 PM.
    Support requests via PM will be ignored!
    Read These: The General Rules Thread | The General FAQ Thread | NEW USERS - How to post a question

  8. #5
  9. GIRL POWER!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Posts
    235
    Rep Power
    0
    Originally Posted by ChiefWigs1982
    Sorry, but I find this very hard to believe.

    Just how tightly did you have your eyes shut while you searched
    Google for help?


    What hateful things? I see nothing wrong with Joseph's reply - he
    has provided you with more than enough ammo to get the job done.

    Don't bite the hand that feeds you.
    I think I'm taking the advice of my friend Tim. Leave here and let him find me a help forum that isn't full of rude people and moderators that let it go on -_-

    Comments on this post

    • ChiefWigs1982 disagrees : No, no, no.
    • compmodder26 disagrees : Not Brilliant!!!
    • patrick.gill disagrees : So you can't be bothered to find a forum yourself either?
    • Xaphan disagrees : just because you were not GIVEN the answer? what ever happened to doing some of it yourself?
  10. #6
  11. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,124
    Rep Power
    4308
    Rude? Who was being rude? Is not giving you a complete working demo for free rude?

    There are several other forums like this one around the web.

    Comments on this post

    • medialint agrees
    Spreading knowledge, one newbie at a time.

    Learn CSS. | PHP includes | HTML Validator | CSS validator

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  12. #7
  13. Cunning Linguist
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2003
    Location
    I used to live at home, now I stay at the house
    Posts
    10,166
    Rep Power
    2042
    Originally Posted by evenstar7139
    I think I'm taking the advice of my friend Tim. Leave here and let him find me a help forum that isn't full of rude people and moderators that let it go on -_-
    Is your friend 'Tim' a [former] member here? This forum is not full
    of rude people; it is actually full of some of the most talented and
    most helpful people I've seen, and as a moderator in this particular
    forum, I resent the accusation that we let anything 'go on'.

    I suggest you change your attitude before posting on this or any
    other forum again - continue the way you are and you will find it
    very hard to come by any help at all.

    Comments on this post

    • crownjewel82 agrees
    • kicken agrees
    • jabba_29 agrees
    • Xaphan agrees
    Last edited by ChiefWigs1982; June 5th, 2006 at 05:27 AM.
    Support requests via PM will be ignored!
    Read These: The General Rules Thread | The General FAQ Thread | NEW USERS - How to post a question

  14. #8
  15. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2003
    Location
    Washington, DC Metro
    Posts
    1,747
    Rep Power
    890
    Originally Posted by evenstar7139
    I think I'm taking the advice of my friend Tim. Leave here and let him find me a help forum that isn't full of rude people and moderators that let it go on -_-
    Feel free to go join another forum. No one made you sign any exclusivity statements when you joined here. You're more than welcome to use more than one (or just another) forum. But just ask yourself: what are you going to learn if someone just gives you the code for this problem?

    You already stated that you don't know JavaScript. So, instead of having someone write that part for you, why don't you look at that as a place for improvement? Whenever I find that there is something I don't know - I try to learn as much as I can about it. If you learn about JavaScript and its events and the DOM, then you don't need to have someone write the code for you and you'll be able to solve future problems such as "How do I highlight a required form field if someone leaves it blank?" If you learned the concepts of JavaScript, you won't need someone to write each and every piece of JS code that you want in your scripts.

    Here are some excellent examples and tutorials for beginners. Follow through them and you should be able to solve this problem VERY easily.

    Comments on this post

    • ishnid agrees

IMN logo majestic logo threadwatch logo seochat tools logo