Results 1 to 3 of 3

Thread: Hidden Field Change

  1. #1
    Join Date
    Oct 2009
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Hidden Field Change

    Hi,

    I have a script that is meant to change the value of a hidden field and then change the css of form in which the hidden field is in to visible.

    The css change works but the change value does not. Can any one help?

    The java code:
    Code:
    <script language="javascript">
    
    function ChangeHiddenValue() {
    	
    	var MyElement = document.getElementById("target_url");
        MyElement.value = "If you see this, it worked!";
    	
    	document.getElementById('sign_in_light').style.display='block';document.getElementById('fade').style.display='block';
    	
    }
    //-->
    </script>
    You click this link to run the program:
    HTML Code:
    <a href = \"javascript:void(0)\" onclick = \"javascript:ChangeHiddenValue(this.value);\">Africa</a>
    And the form:
    HTML Code:
    <form action="xxxx.php" method="post" enctype="multipart/form-data" name="sign_in_light" id="sign_in_light" onsubmit="return rsv.validate(this, sign_in_rules)">
    <div class="signinpatchformline"><span class="signinpatchformlinetext">Email:</span><input name="email" id="email"/>
      <input type="hidden" name="target_url" id="target_url"  value="" />
    </div>
    <div class="signinpatchformline"><span class="signinpatchformlinetext">Password:</span><input name="password" type="password" id="password"/>
    </div>
    <div class="signinpatchbutton"><span class="signinpatchformlineforgot">Forgot your password?</span>
      <div class="buttonsright"><button type="submit" class="darkblue">Sign in</button></div></div>
    </form>
    All help is appreciated.

    Cs1h

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Try this instead:

    Code:
    <script type="text/javascript">
    
    function ChangeHiddenValue(newval) {
    
        document.getElementById("target_url").value = newval;
    	
        document.getElementById('sign_in_light').style.display='block';
        document.getElementById('fade').style.display='block';
    }
    </script>
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. The Following User Says Thank You to thetestingsite For This Useful Post:

    cs1h (10-01-2009)

  4. #3
    Join Date
    Oct 2009
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    thanks,

    that works great.

    Cheers,
    Cs1h

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
  •