• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 228
  • Last Modified:

Posting to more than one file...

hi..

I need to know if it is possible to send the form inputs to
two files (instead of posting them only to one file?

let's assume that i have a form with:
3 one-line text area
3 scrolling text area
1 checkbox

How can i post ALL form inputs to file1.cgi   and
post only 2 one-line text area & 1 checkbox to file2.cgi

can this be done?

thanks


mary
0
mary_M
Asked:
mary_M
  • 4
  • 2
  • 2
  • +2
1 Solution
 
oleberCommented:
javascript
0
 
oleberCommented:
javascript
0
 
oleberCommented:
I'm not working whith javascript for some time but you can assign values to variables and submit to diferent forms.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
PeeweeCommented:
mary_M,
this problem crops up from time to time.  The bottom line is that an action statement within a form can only have one script to execute.  

What is possible is to call a javascript routine within the action statement and get javascript to submit multiple forms, but this gets messy, although if your carefull its a valid option.

What most developers will do is store all the info in one form and call different perl scripts which different processing, but the choice is your yours.

for good javascript examples:
http://www.irt.org

let me know if you need more help....

peewee
0
 
maneshrCommented:
mary_M,


"..How can i post ALL form inputs to file1.cgi   and
                     post only 2 one-line text area & 1 checkbox to file2.cgi...."

What exactly do you mean by post form inputs to 2 files?
The files you are referring to are CGI programs.

Can you pl. explain, in plain english, what each of these scripts will do when they receive the inputs?
Can you post any relevent URL that has the HTML form that you are talking about?

"..can this be done?..."

Technically, there is always a solution. So i a optimistic that you can get a satisfactory answer, provided you provide more detail around your exact requirements.

Let me know.

0
 
Kim RyanIT ConsultantCommented:
As peewee says, a form can only have one associated action, or script to be executed on submission. Can you use 2 forms instead? A workaround is to have all paramters passed to your submit script, called say file1.cgi. Then let file1.cgi call file2.cgi, passing all the form paramters to it AND then call file3.cgi, just passing the parameters for the 2 one-line text areas & 1 checkbox.
0
 
mary_MAuthor Commented:
Hi everybody...

someone told me that this can be done by JS (as you all
suggetsed)

"...by putting an onSubmit="..." attribute into the
<form... tag.

The onSubmit causes a JavaScript function to load and
run the file, when done, returns  true.

The JavaScript function could launch a popup that runs
a script and  closes automatically after the script has
run."

Well, but i still don't know how to do this?!

Here is the whole story (for maneshr   and others who
requested more info):

I currently have a form that takes all data (upon
pressing sunmittion) and stores all values in an SQL DB

I didn't do that form... but it is working without any
problems.....

ok the fileds are:
Name:
Email:
Brief Describtion:
URL:
Newsletter?:   (a check box, once checked the submitter
is going to get a newsletter to his email).

What i need.. is to leave everything is it working
now... i.e. all the above value will go to the DB as
usual...

BUT

I need to take the values in the name,email and store them in
another separate file like newsletter.txt

In other words...if the checkbox is left checked (default)..
ALL inputs will go to the DB... AND name/email fileds only will
also be stored into a file: newsletter.txt
(or whatever the name is).
0
 
oleberCommented:
first of all, can't you do that in just 1 script.

you maybe can do that in other way. You first call your script that put your data in the "newsletter.txt" if need. Your script creates a new page whith just a form that have hidden fields and in js you submit that form to your old script.

your first script generate something like

<html>
 <head><title></title></head>
 <body>
  <form method="POST" name='xpto' action="oldScript.pl">
   <input type="hidden" name="Name" value="xxx">
   ...
  </form>
  <SCRIPT LANGUAGE="JavaScript">
   document.xpto.submit()
  </SCRIPT>
 </body>
</html>

and your old script shell work OK.
0
 
Kim RyanIT ConsultantCommented:
Maybe you should raise this question in the javascript area.
0
 
PeeweeCommented:
mary_M,

have a look at the following links this covers your question:

http://developer.irt.org/script/880.htm

http://developer.irt.org/script/1333.htm

regards
peewee
0
 
mary_MAuthor Commented:
Peewee  ..

YES.. these are *exactly* what i needed.

One question: How did you locate these two answers in that webste... the website is too big.. so what words did you use to search for?


Thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now