Connecting Tech Pros Worldwide Forums | Help | Site Map

Displaying Form Names on Post Page

Agent Michael Scarn
Guest
 
Posts: n/a
#1: Sep 7 '06
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[i].name + "&";
// -->
</script>

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

Thanks!


Joshie Surber
Guest
 
Posts: n/a
#2: Sep 8 '06

re: Displaying Form Names on Post Page


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[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:
Quote:
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[i].name + "&";
// -->
</script>
>
<script language="JavaScript" type="text/javascript">
<!--
document.write(elements);
// -->
</script>
>
Thanks!
Agent Michael Scarn
Guest
 
Posts: n/a
#3: Sep 8 '06

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?

Closed Thread