Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing data between forms

Status
Not open for further replies.

pavan196

Programmer
Sep 28, 2006
3
US
Hi all,
I am trying to pass user data(such as selections made in a drop down list) to a different form where the data has to be displayed in the form of a table. However I do not want to submit the new form to the server yet. After the data has been passed to the new form, the user fills out the remaining portions of the main form and I will have to submit the main form and the new form both to the server. I have used CGI and Javascript to build the main form. Can anyone give me pointers on how should I proceed.
Thanks,
Pavan
 
write the data from the first form to a file on the server and read it back whenever needed. You could also use hidden form fields on the second form and store the data from the first form that way and send it with the final form submission. That would require the second form be generated dynamically by a script. The CGI.pm module can handle this type of stuff no problem assuming you are using perl as the backend.
 
Hi Kevin,
Thanks for the suggestions. I have a few questions though. Right now I am trying to open the new form by a window.open function resulting from a onclick event handler of a button from the main form, Can I reference the parent forms elements using the cgi->param operator? I am confused because all the user selections in the parent form are stored as javascript variables and I am not sure no how to store these in the database.
Thanks for the help
Pavan
 
If you're using Perl, I'd suggest looking into CGI::Sessions as well. This module takes care of storing the information for you in either a database or flat file for future use.

- George
 
Hi
Thanks for the suggestions , but I still hava doubt because I have a main form which has a action event which is triggered when a submit button is pressed. But then I have an additional button in the main form which on click should open a new form to which i need to pass values from the main form. I am confused on how to open a new form from the button click as a form can have only one action event associated to it.It would be great if anyone can help me out.
Pavan
 
It sounds to me like you're mixing things that you should be doing with Perl/CGI and javascript.

If you want to open a second form (page) with the content filled in on the first form without submitting to the server, then you'll have to use something that will work completely on the client side, e.g. javascript.

Once you have all of your inputs completed on the client side, then submit to the server via a CGI Form Action.


'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top