SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Keep Moving Forward gold trophysilver trophybronze trophy
    Shaun(OfTheDead)'s Avatar
    Join Date
    Nov 2005
    Location
    Trinidad
    Posts
    3,727
    Mentioned
    43 Post(s)
    Tagged
    0 Thread(s)

    Re-enabling a Form Element

    So I've been using...

    Code JavaScript:
    document.getElementById("LoginForm_Password").disabled = 'true';

    ...to dis-able the password field of an HTML form when a viewer submits data.

    Cool... that works.

    The problem comes when I try to re-enable the password field.

    Logic would tell you that it would be...


    Code JavaScript:
    document.getElementById("LoginForm_Password").disabled = 'false';

    ...but this has ALSO been dis-abling the field !

    I tested it time and time again, removing all other factors, and over and over again setting setting disabled to 'false' is still dis-abling my password field.

    Am I missing something completely obvious ?




    Trying to fill the unforgiving minute
    with sixty seconds' worth of distance run.

    Update on Sitepoint's Migration to Discourse

  2. #2
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,751
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm, my only guess is that 'false' is a string, which if converted to a boolean value is actually true, because it's a non-empty string. Try it without the quotes and see if that does anything.

  3. #3
    Keep Moving Forward gold trophysilver trophybronze trophy
    Shaun(OfTheDead)'s Avatar
    Join Date
    Nov 2005
    Location
    Trinidad
    Posts
    3,727
    Mentioned
    43 Post(s)
    Tagged
    0 Thread(s)
    Okay for whatever reason, leaving out the quotation marks worked.

    Code JavaScript:
    document.getElementById("LoginForm_Password").disabled = false;

    At least it's problem solved.






    Trying to fill the unforgiving minute
    with sixty seconds' worth of distance run.

    Update on Sitepoint's Migration to Discourse

  4. #4
    Keep Moving Forward gold trophysilver trophybronze trophy
    Shaun(OfTheDead)'s Avatar
    Join Date
    Nov 2005
    Location
    Trinidad
    Posts
    3,727
    Mentioned
    43 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by chris_fuel
    Hmm, my only guess is that 'false' is a string, which if converted to a boolean value is actually true, because it's a non-empty string. Try it without the quotes and see if that does anything.
    hahahaha

    Thanks for the explanation.

    We posted at the same time.




    Trying to fill the unforgiving minute
    with sixty seconds' worth of distance run.

    Update on Sitepoint's Migration to Discourse


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
  •