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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending email with new record info using asp??

Status
Not open for further replies.

SFalk

Technical User
Apr 30, 2006
8
US
Hi guys,

I currently have a web form that submits info to a FileMaker Pro 5 database. I need it to also send the same info in an email to a third party. Any ideas how to set this up?

This is the call for the form:
Code:
<FORM ACTION="FMPro" METHOD="post">[\code]

Thanks!
Sarah
 
You could first submit the form to an ASP page that would email the data using CDOSYS or whatever email capability is set up on the server, then have the ASP script write the form again with hidden inputs and automatically submit that to FMPro like you show here.

It looks like there's a plug-in for FileMaker Pro that will take care of sending email for you, and there's more info on that kind of thing here:


Lee
 
Thanks. =) Can you give me some direction on how to have the ASP form write the script again?
 
What do you know of ASP? Which language do you use?

The Request.Form object is a collection of all the input names and their values from the previous page. If you loop through that (if you don't know the Request.Form object, you can find this exact type of thing in ASP tutorials found in a Google search), write an <input type="hidden"> with the Request.Form name and value, then

document.forms[0].submit();

at the bottom of the page after the form is created.

Lee
 
It's starting to make sense...
Is this what you mean?

In the original form, I set this:
Code:
<form name="form" method="post" action="mail.asp"> 

<input name="username" type="text">
Request.Form(username) = form.username.value[\code]

Then, in the mail.asp file, I send mail like usual and include [code]<input type="hidden" name="username" value="Request.Form(username)>[\code]

How do I tell it, in the mail.asp file, this part: <form action="FMPRo" method="post">   ?

Thanks!
Sarah
 
Here's JScript (for ASP) code that writes the form variables from the submitted page into hidden inputs:
Code:
for (var ki=1;ki<=Request.Form.Count;ki++)
  {
  var keyname=Request.Form.Key(ki);
  var keyvalue=Request.Form.Item(keyname);
  Response.Write('<input type="hidden" name="' + keyname + '" value="' + keyvalue + '">');
  }

You'd put your opening form tag on the page before this loop, the closing form tag after it, and the Javascript to submit the page after that. If you don't use JScript for your ASP language, you'll have to convert it to whatever language you do use.

Lee
 
trollacious, how would such a script handle values for checkboxes and radio buttons especially those in groups?
I would suspect that it would not even find occurances of radio buttons that were not checked.

Just wondering what additional checking might be needed in case the app he submits to for the database is looking for specific fields that may not get created.
It may not be an issue, I have not tried to do this myself yet but was thinking about working out an automatic data persistance script for these types of occasions and things like posting some of the data back to the original form so additional requests can be submitted without having to fill out key informational fields repeatedly.


It's hard to think outside the box when I'm trapped in a cubicle.
In an increasingly self-focused society it is important to recognize the unselfish actions of others so they will feel encouraged to continue such actions. Please give acknowledgement to those who aid you whether it is waving to the person who let you out in traffic, tha
 
You're correct that the script won't send key names or values for checkboxes not checked or radio buttons not checked. But the form doesn't send that data now, either. If there were multiple checkboxes with the same name, the script I provided would create one hidden input and put a comma-delimited list for the value. This passes along the data exactly as it's received, and the page it's submitted to will see the same data and format as it would if this page weren't an intermediate step.

The FMPro processing already has to handle data items that aren't passed over to it in the form, so that would have to be built in. The above would provide all the data available in the form, which I believe is all that would be available if the form was submitted straight to FMPro.

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top