Displaying Form Names on Post Page

  • Thread starter Agent Michael Scarn
  • Start date
A

Agent Michael Scarn

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="JavaScript" type="text/javascript">
<!--
var myForm = document.forms.f;
var elements = ""
for (i = 0; i < myForm.elements.length; i++)
elements = elements + myForm.elements.name + "&";
// -->
</script>

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

Thanks!
 
J

Joshie Surber

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

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

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

Agent Michael Scarn

Thanks for the response.

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

David Dorward

Agent said:
Thanks for the response.

Please quote to provide context.
It worked, but is there a way to show the hidden fields as well?

By the time the data gets to the query string, there is nothing to
distinguish between fields that were hidden and other field types. The
hidden ones will be shown as well.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top