By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,483 Members | 1,727 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,483 IT Pros & Developers. It's quick & easy.

Displaying Form Names on Post Page

P: n/a
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!

Sep 7 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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:
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!
Sep 7 '06 #2

P: n/a
Thanks for the response.

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

Sep 8 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.