Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Passing information to a hidden field

Passing information to a hidden field
Thread Tools
Junior Member
Join Date: Nov 2000
Location: Goose Creek, SC, USA
Status: Offline
Reply With Quote
Jun 6, 2001, 10:11 AM
 
I have a form that takes some information from people. When a button is pushed at the end of the form it starts a JavaScript function that validates all the information and then displays it back in a new window. Now inside the function that display's the information taken from form1 is a hidden form. This form is part of the html that comprises the display window. There is a submit button on the display window which sends the information in the hidden form fields to a cgi script for server side processing. Now here is my problem. How do I get the information from the form where the information is entered to the hidden form fields? When the information is posted to the cgi script instead of the data entered in the form what is shown is the locations where the data should be (document.form1.name.value) instead of whatever name was entered.
Here is a piece of what I am doing. How do I fix the value attribute to not literally display document.form1.firstname.value and have it display the info that is contained in it?
message +="<input type='hidden' value='document.form1.firstname.value' name='firstname' />"
     
Junior Member
Join Date: May 2001
Location: the third paradigm
Status: Offline
Reply With Quote
Jun 7, 2001, 12:25 AM
 
I won't say that I don't think there's a way to do this with JavaScript, cause I'm 90 percent sure there is, but I don't know what it is. I suggest checking out [url=http://www.webmonkey.com] and their JS tutorials if you wish to keep looking.

I suggest, however, if you're already writing CGI scripts, just have the job that the JS was going to do done by a CGI. You can print HTML to the browser with Perl just as easily as with JS and it's easy to access the variables in that language. They will be stored as post or get variables from the first form and then you can just do a <input type="hidden" name="varname" value=$variable1>

Any reason you're avoiding that?

when you look this good, you don't have to know anything
     
Dedicated MacNNer
Join Date: Apr 2001
Location: San Francisco, USA
Status: Offline
Reply With Quote
Jun 7, 2001, 03:51 PM
 
Originally posted by skeedog98:
<STRONG>How do I fix the value attribute to not literally display document.form1.firstname.value and have it display the info that is contained in it?</STRONG>
Like this?

message += "&lt;input type='hidden' value='" + document.form1.firstname.value + "' name='firstname' /&gt;"
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:06 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2