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

how to allow the user to set the recipient in a form as a text input field?

elamberdor
P: 39
Hi All!

I would like to give the user the opportunity to insert their own recipient of the form data, so that they can sent it onto their specific supervisor in their department. And if possible have an additional Cc (i can insert the email for this one) when submitted also.

Its currently:
[HTML]<input type="hidden" name="mailto" value="email@email.com.au" />[/HTML]

I have seen things that use preselected multiple select emails from a radio/check or drop down, but I need them to insert their own.

Security wise, it can be put behind a staff only .htaccess file if needs be.

Please pleaseee let me know this is possible without much alteration to the /cgi-pub/publish/formScript.pl!


Many millions of thanks in advance for your advice!
Jul 23 '08 #1
Share this Question
Share on Google+
8 Replies


KevinADC
Expert 2.5K+
P: 4,059
well, replace this:

Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="mailto" value="email@email.com.au" />
with:

Expand|Select|Wrap|Line Numbers
  1. <input type="text" name="mailto" />
but unless you trust everyone that will use the form the data they enter into the input field will have to be validated before allowing your script to use it.
Jul 23 '08 #2

elamberdor
P: 39
well, replace this:

Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="mailto" value="email@email.com.au" />
with:

Expand|Select|Wrap|Line Numbers
  1. <input type="text" name="mailto" />
but unless you trust everyone that will use the form the data they enter into the input field will have to be validated before allowing your script to use it.
Thank you muchly for the fast reply! I will experiment thusly!
Once I posted I read a bit more about unforeseen spam issues, and I was hoping hiding it behind the ht access would help? Still it is a concern for me...

Sorry may I get clarification on where the validation occurs? By validated you mean specifying that the characters in that form field must resemble a email input? such as "something@something.com" ?

If so, can you get specific, say, validate those emails with my domain only as ending? such and 'anyemail-i-like@mydomain.com"?

Thankyou in advance KevinADC!
Jul 23 '08 #3

KevinADC
Expert 2.5K+
P: 4,059
Thank you muchly for the fast reply! I will experiment thusly!
Once I posted I read a bit more about unforeseen spam issues, and I was hoping hiding it behind the ht access would help? Still it is a concern for me...

Sorry may I get clarification on where the validation occurs? By validated you mean specifying that the characters in that form field must resemble a email input? such as "something@something.com" ?

If so, can you get specific, say, validate those emails with my domain only as ending? such and 'anyemail-i-like@mydomain.com"?

Thankyou in advance KevinADC!
The validation would occur in the perl script. And by vaidation I do mean that the data entered would have to be checked (validated) to make sure it is a valid email address. You can use the Email::Valid module to do that but it probably needs to be installed. Right now it is very late here (1:30AM), I am off to bed. I will check back later and see if you still need help.
Jul 23 '08 #4

elamberdor
P: 39
no worries - thank you for your advice in the right direction! :)
Jul 23 '08 #5

elamberdor
P: 39
okay! I've had a play!

This form normal script without custom mail recipient = working.

when I adjust the line:
[HTML]<input type="hidden" name="mailto" value="me@domain.com" />[/HTML] in the form script, to read:
[HTML]<input type="hidden" name="mailto" value="mailto" />[/HTML]

I've read that if it is an input field, it must be added to the required field, so I did:
[HTML]<input type="hidden" name="required" value="first_name,email,mailto" />[/HTML] (changed from "email_manager")
Side note: When i don't change required name as mentioned, our validator comes up, mentions it can't send for a reason, but cannot specify which field as it usually does.

And then in the form itself, the Managers Email input field is changed from:
[HTML]<li><label for="email_manager" class="required">Your H.O.S/Managers Email *</label>
<!--email --><input name=" email_manager " type="text" id=" email_manager " size="35%" />[/HTML]

to

[HTML]<li><label for="mailto" class="required">Your H.O.S/Managers Email *</label>
<!--email --><input name="mailto" type="text" id="mailto" size="35%" />[/HTML]

It comes up with an error saying:
formScript.pl Error
________________________________________
Bad hidden mailto .

Hidden maito's must be *OUR DOMAIN* email addresses only!
I've put several valid email addresses in - but no emails, and no acknowledgment emails. (App. they're auto - so my Cc prob is fixed)

I'm trying to nut it out with the programmers here, but I don't want to burden them - they're stressed enough!

Any ideas?
Jul 24 '08 #6

KevinADC
Expert 2.5K+
P: 4,059
The problem is specific to your script, not perl or CGI, and I am not familiar with "formScript.pl". Hopefully it has detailed instructions you can read to figure it out.
Jul 24 '08 #7

elamberdor
P: 39
thanks for the reply!

yar, we're working to modify it slightly now, but thankyou for helping me look less clueless to the our programmers! =D

When we work it out - i'll post it up!
Jul 24 '08 #8

elamberdor
P: 39
sort of a dodgy hack fix :)

you get an auto reply with the email you fill in automatically with the script, and the end recipient's addy is hard-coded, so what we did was switch the id's of the Cc to be the 'your email' field, and they get a "thankyou for submitting " email header, you get nought. Not the greatest hack, but in the end they client decided to chaneg their mind and wanted a PDF based form... go figure

:S
Aug 22 '08 #9

Post your reply

Sign in to post your reply or Sign up for a free account.