How to change the Hidden Value from Javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Velhari
    New Member
    • Sep 2006
    • 46

    How to change the Hidden Value from Javascript

    Hell sir,
    How to change the value of hidden field in a form from javascript code

    Please reply me as soon..........


    With regards,
    Velmurugan.H
  • Nert
    New Member
    • Nov 2006
    • 64

    #2
    Originally posted by Velhari
    Hell sir,
    How to change the value of hidden field in a form from javascript code

    Please reply me as soon..........


    With regards,
    Velmurugan.H
    hi,

    if you don't mind can you please clarify what your problem is. Well
    any way this might help you, in javascript we have the function getElementById( )
    with this function you can distinguish which object you want to change the value, get the value or anything you want to do with the object within a document.

    example i have this form without any button

    <form name="sample" id="sample" method="post" action="sample. php">
    <input type="text" name="text" value="Sample text" />
    </form>

    now i want to submit it with just clicking a plane text, i'll do that with just simple as this.

    <p onClick="javasc ript: document.getEle mentById('sampl e').submit();">
    Click This
    </p>

    try to expand my sample and you will get what you want to do in your project


    bye bye

    --nert

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      This thread belongs in the Javascript forum, so I will move it.

      Ronald :cool:

      Comment

      • iam_clint
        Recognized Expert Top Contributor
        • Jul 2006
        • 1207

        #4
        Example
        Code:
        <input type="hidden" id="hiddenstuff" value="nothing">
        <input type="button" value="Change Hidden Text!" onclick="changehidden();">
        <script>
        function changehidden() {
        document.getElementById("hiddenstuff").value = "NEW HIDDEN STUFF!";
        }
        </script>

        Comment

        • TheMadMidget
          New Member
          • Oct 2006
          • 98

          #5
          suppose
          Code:
          <form name=TestName>
               <input type=hidden name=MeWannaChange value=WhoCaresImGoingToChangeThis>
          </form>
          Then use
          Code:
          <script>
          TestName.MeWannaChange = "NewValue";
          </script>
          -or-
          Code:
          <script>
          document.TestName.MeWannaChange = "NewValue";
          </script>

          Comment

          Working...