Displaying Form Names on Post Page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Agent Michael Scarn

    Displaying Form Names on Post Page

    Hello,

    I need to be able to dynamically display all of the form names from a
    form I just submitted.

    I have a javascript which will display all the names of the form on the
    first page, but i need them displayed on the post page.

    Any help would be greatly appreciated!

    Here is the javascript that works on the first page...

    <script language="JavaS cript" type="text/javascript">
    <!--
    var myForm = document.forms. f;
    var elements = ""
    for (i = 0; i < myForm.elements .length; i++)
    elements = elements + myForm.elements[i].name + "&";
    // -->
    </script>

    <script language="JavaS cript" type="text/javascript">
    <!--
    document.write( elements);
    // -->
    </script>

    Thanks!

  • Joshie Surber

    #2
    Re: Displaying Form Names on Post Page

    If you are using GET for your forms, you can do this:

    var query = window.location .search.substri ng(1);
    var vars = query.split("&" );
    for (var i=0;i<vars.leng th;i++) {
    var pair = vars[i].split("=");
    document.write( pair[0]);
    }

    If you are using POST you must use a server-side script to do this.

    Agent Michael Scarn wrote:
    Hello,
    >
    I need to be able to dynamically display all of the form names from a
    form I just submitted.
    >
    I have a javascript which will display all the names of the form on the
    first page, but i need them displayed on the post page.
    >
    Any help would be greatly appreciated!
    >
    Here is the javascript that works on the first page...
    >
    <script language="JavaS cript" type="text/javascript">
    <!--
    var myForm = document.forms. f;
    var elements = ""
    for (i = 0; i < myForm.elements .length; i++)
    elements = elements + myForm.elements[i].name + "&";
    // -->
    </script>
    >
    <script language="JavaS cript" type="text/javascript">
    <!--
    document.write( elements);
    // -->
    </script>
    >
    Thanks!

    Comment

    • Agent Michael Scarn

      #3
      Re: Displaying Form Names on Post Page

      Thanks for the response.

      It worked, but is there a way to show the hidden fields as well?

      Comment

      Working...