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

Two different values set in one select/option choice

P: n/a
I can have a visitor choose a subject line for an email.

<div><label for="subject">Subject:</label><br />
<select class="form" id="subject" name="subject">
<option value="one">One</option>
<option value="two">Two</option>
<option value="three">Three</option>
</select></div>

I can also have them choose a destination.

<div><label for="recipient">Send email to:</label><br />
<select class="form" id="recipient" name="recipient">
<option value="1">Membership</option>
<option value="2">Personnel</option>
<option value="3">Webmaster</option>
</select></div>

Is it possible to do both together (without rewriting the script, as I'm
nowhere near qualified to be messing in that)? In other words, the user
would select an option which gives the topic as a subject line they are
writing about, AND that selection is automatically routed to the
appropriate recipient for that subject?

I could use the subject in the text and the email address as the value,
but one email recipient would be getting email on more than one topic, so
some means of setting both subject and recipient would be necessary. So
the webmaster might get emails with subject "Bug Report" or "Link
Submission", the subject line would serve to enable the emails to be
sorted properly, but emails with subjects like "Request New Password" or
Membership Question" would go to a different email address.

If it's not possible to rig this in the form itself, what options exist
that I haven't even entertained?
Jul 20 '05 #1
Share this Question
Share on Google+
19 Replies


P: n/a
In article <op**************@news.rcn.com>, ne*****@spamrcn.com
enlightened us with...

Is it possible to do both together (without rewriting the script, as I'm
nowhere near qualified to be messing in that)? In other words, the user
would select an option which gives the topic as a subject line they are
writing about, AND that selection is automatically routed to the
appropriate recipient for that subject?


Sure.
I assume the server side script expects particular values recipient and
subject?
Have the selection of subject write the recipient to a hidden input.

Keep in mind this requires javascript. Not everyone HAS javascript
(enabled). So, caveat emptor.
It may be preferable to do the decision on who the recipient is in the
server-side script.

If you want the javascript solution, it is pretty easy. I can throw an
example together for you.
If you want the server-side solution, tell me which language you're
using. :)
--
--
~kaeli~
Acupuncture is a jab well done.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #2

P: n/a
Neal wrote:

I could use the subject in the text and the email address as the
value, but one email recipient would be getting email on more than
one topic, so some means of setting both subject and recipient would
be necessary. So the webmaster might get emails with subject "Bug
Report" or "Link Submission"


Do you have control over email addresses? You could create different
email addresses for each topic. bu********@example.com,
li*************@example.com, me********@example.com

If one person should get two categories, forward both addresses to the
same inbox. Then the recipients will know the topic by the to: field.
Not nearly as neat as a script solution, mind you.

You might have a look at TFMail, from NMS. It is a more advanced form
mail script. If you can install CGI scripts, it might do the job for you.

--
Brian (remove "invalid" from my address to email me)
http://www.tsmchughs.com/
Jul 20 '05 #3

P: n/a
On Mon, 23 Feb 2004 14:59:41 GMT, Brian
<us*****@julietremblay.com.invalid> wrote:
Neal wrote:

I could use the subject in the text and the email address as the
value, but one email recipient would be getting email on more than
one topic, so some means of setting both subject and recipient would
be necessary. So the webmaster might get emails with subject "Bug
Report" or "Link Submission"
Do you have control over email addresses? You could create different
email addresses for each topic. bu********@example.com,
li*************@example.com, me********@example.com

If one person should get two categories, forward both addresses to the
same inbox. Then the recipients will know the topic by the to: field.
Not nearly as neat as a script solution, mind you.


Oh my, our host allows 500 email addresses. My only problem is that if I
go the separate email route, most of the folks involved are a little inept
with computers, which means a LOT of hands-on tech help from me to get
these email addresses up and running - though there are forwarding and
other options there too. An excellent solution, but a last choice.


You might have a look at TFMail, from NMS. It is a more advanced form
mail script. If you can install CGI scripts, it might do the job for you.


Thanks for the tip - will look at it.
Jul 20 '05 #4

P: n/a
On Mon, 23 Feb 2004 07:57:06 -0600, kaeli <ti******@NOSPAM.comcast.net>
wrote:
Sure.
I assume the server side script expects particular values recipient and
subject?
Have the selection of subject write the recipient to a hidden input.

Keep in mind this requires javascript. Not everyone HAS javascript
(enabled). So, caveat emptor.
It may be preferable to do the decision on who the recipient is in the
server-side script.

If you want the javascript solution, it is pretty easy. I can throw an
example together for you.
If you want the server-side solution, tell me which language you're
using. :)


Well, I don't want you to have to write a script for me. I can get the
page to write "Hello world" and that's about it ;). Besides, I do want to
avoid any reliance on Javascript on this site, our typical user is not
running top-of-the-line equipment and software, and is usually not
particularly computer savvy.

I guess the reality is that selecting the recipient and the subject value
cannot be done with one select box. I might do it in another method -
perhaps by having them choose a subject, then have the user get sent to a
page which has an email form set up for that specific recipient and all...
a few options exist, thanks for your help!
Jul 20 '05 #5

P: n/a
In article <op**************@news.rcn.com>, ne*****@spamrcn.com
enlightened us with...

Well, I don't want you to have to write a script for me.


I'm sure it's a simple if-then-else. :)
Seriously.
Take me two minutes.
Just tell me the language.

I guess the reality is that selecting the recipient and the subject value
cannot be done with one select box. I might do it in another method -
perhaps by having them choose a subject, then have the user get sent to a
page which has an email form set up for that specific recipient and all...
a few options exist, thanks for your help!


You're overcomplicating yourself - having a bunch of pages is too much
upkeep for such an easy task.

--
--
~kaeli~
Why do they sterilize the needles for lethal injections?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #6

P: n/a
On Mon, 23 Feb 2004 10:11:23 -0600, kaeli <ti******@NOSPAM.comcast.net>
wrote:
In article <op**************@news.rcn.com>, ne*****@spamrcn.com
enlightened us with...
>


Well, I don't want you to have to write a script for me.


I'm sure it's a simple if-then-else. :)
Seriously.
Take me two minutes.
Just tell me the language.

Insistent! :)

I'm using the NMS formmail.pl on the site. So something that could be
added to that (without messing it up for another form on the site) would
be perfect. I suppose if the suject is K the recipient is L, and so on. I
know jack shit about scripting, but sounds like something one could do...
Jul 20 '05 #7

P: n/a
On Mon, 23 Feb 2004 14:59:41 GMT, Brian
<us*****@julietremblay.com.invalid> wrote:
You might have a look at TFMail, from NMS. It is a more advanced form
mail script. If you can install CGI scripts, it might do the job for you.

I read through the documentation. Seems to me the only real extra bits are
more power over the confirmation message (which I'm satisfied with in my
current version), the ability to template the email better (which doesn't
matter to me), and support for emailing attatchments (read "the ability to
transport viruses", no thank you).

Are you aware of another improvement to the formmail that I'm not getting?
Jul 20 '05 #8

P: n/a
Neal wrote:
On Mon, 23 Feb 2004, kaeli wrote:
In article <op**************@news.rcn.com>, ne*****@spamrcn.com
enlightened us with...
Well, I don't want you to have to write a script for me.


I'm sure it's a simple if-then-else. :)
Just tell me the language.


I'm using the NMS formmail.pl on the site.


And to kaeli, that's a cgi program written in Perl. ;-)

--
Brian (remove "invalid" from my address to email me)
http://www.tsmchughs.com/
Jul 20 '05 #9

P: n/a
Neal wrote:
On Mon, 23 Feb 20, Brian wrote:
You might have a look at TFMail, from NMS. It is a more advanced
form mail script.


I read through the documentation. Seems to me the only real extra
bits are more power over the confirmation message

Are you aware of another improvement to the formmail that I'm not
getting?


No, that's it. Sorry for the red herring. I thought there was more to
it, but on rereading the docs, it doesn't seem to be able to help you.

--
Brian (remove "invalid" from my address to email me)
http://www.tsmchughs.com/
Jul 20 '05 #10

P: n/a
In article <ovG_b.388329$xy6.2201786@attbi_s02>, usenet3
@julietremblay.com.invalid enlightened us with...

I'm using the NMS formmail.pl on the site.


And to kaeli, that's a cgi program written in Perl. ;-)


No, really? :p

--
--
~kaeli~
Those who get too big for their britches will be exposed in
the end.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #11

P: n/a
In article <op**************@news.rcn.com>, ne*****@spamrcn.com
enlightened us with...


Insistent! :)

I'm using the NMS formmail.pl on the site. So something that could be
added to that (without messing it up for another form on the site) would
be perfect. I suppose if the suject is K the recipient is L, and so on. I
know jack shit about scripting, but sounds like something one could do...


Wow, that's nearly impossible to modify without affecting anything else
that uses it. I stand corrected.
It's not hard to modify - it's hard to modify without mucking it up for
other applications.

You're stuck with using javascript or multiple forms. Sorry. :(

The problem is that the recipients are gotten right from a hidden form
field and it's buried deep in the script (instead of in the config
section, where, IMO, it should be). So that whole piece would need a
rewrite.

You can still use a simple javascript function to change the recipient
based on the subject, but like I said, that would require that the users
have javascript enabled.

The config for formmail has this recipient alias field that could come
in handy for that.
From the readme...
%recipient_alias - A hash for predefining a list of recipients in the
script, and then choosing between them using the
recipient form field, while keeping all the email
addresses out of the HTML so that they don't get
collected by address harvesters and sent junk
email.

For example, suppose you have three forms on your
site, and you want each to submit to a different
email
address and you want to keep the addresses hidden.
You might set up %recipient_alias like this:

%recipient_alias = (
'1' => 'o**@your.domain',
'2' => 't**@your.domain',
'3' => 't****@your.domain',
);

In the HTML form that should submit to the
recipient
't**@your.domain', you would then set the
recipient
with:

<input type="hidden" name="recipient" value="2" />
So, obviously formmail was not intended to be able to hardcode the
recipient right in the script.
That kinda sucks.

I've got a nice JSP (or ASP) formmail script if you'd like to use
that...

--
--
~kaeli~
He had a photographic memory that was never developed.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #12

P: n/a
On Tue, 24 Feb 2004 08:26:23 -0600, kaeli <ti******@NOSPAM.comcast.net>
wrote:

Wow,
Yeah.
that's nearly impossible to modify without affecting anything else
that uses it.
Kinda what I figured. :)
You're stuck with using javascript or multiple forms. Sorry. :(


I still have the 500 email addresses - I think the host allows any number
to be forwarded to other addresses, that might be the best option. Set up
separate email values for each choice, and then in my control panel
determine what "real" email address gets the email.

Would this work, do you think? I use the alias function. What if "1" were
to equal, say, "em***@domain.com?subject=one" (probably spelled that
wrong...) and "2" to "em***@domain.com?subject=two" ? Is that even worth
testing, or am I full of beans here? As everything goes through our
sendmail, and I know our email passes the ?subject values from the days we
used mailtos, worth a shot?
Jul 20 '05 #13

P: n/a
In article <op**************@news.rcn.com>, ne*****@spamrcn.com
enlightened us with...

Would this work, do you think? I use the alias function. What if "1" were
to equal, say, "em***@domain.com?subject=one" (probably spelled that
wrong...) and "2" to "em***@domain.com?subject=two" ? Is that even worth
testing, or am I full of beans here? As everything goes through our
sendmail, and I know our email passes the ?subject values from the days we
used mailtos, worth a shot?


Well, sendmail uses the subject param, but formmail is already passing a
subject to sendmail, so that might not work as you were intending...

Honestly, if it were me, I'd have a default mail catcher for non-js
browsers and jave JS dynamically write the reciepient field. The people
who don't have js enabled are really a minority.

Like so...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title> New Document </title>
</head>

<body>
<script type="text/javascript" language="javascript">
var sArray = new Array(
"de************@domain.com",
"su*********@domain.com",
"co***********@domain.com",
"co************@domain.com"
);

</script>
<form name="f1" method="get">
<input type="hidden" name="recipient" value="de************@domain.com">
<select name="subject" onChange="this.form.recipient.value=sArray
[this.selectedIndex];">
<option value="">-- Choose one -- </option>
<option value="Support">Support</option>
<option value="Complaint">Complaint</option>
<option value="Compliment">Compliment</option>
</select>
<br>
<input type="submit">
</form>
</body>
</html>

--
--
~kaeli~
If at first you don't succeed, skydiving is not for you.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #14

P: n/a
kaeli wrote:
[re: NMS formmail.pl Brian wrote]
And to kaeli, that's a cgi program written in Perl. ;-)


No, really? :p


heh. Well, how was I to know that you were familiar with NMS formmail?
So,

:p right back at ya!

--
Brian (remove "invalid" from my address to email me)
http://www.tsmchughs.com/
Jul 20 '05 #15

P: n/a
Neal wrote:

Is it possible to do both together? In other words, the user would
select an option which gives the topic as a subject line they are
writing about, AND that selection is automatically routed to the
appropriate recipient for that subject?


As it turns out, it looks like TFMail can do this. You can choose
different email templates based on a _config field, which is normally a
hidden field.

<input type="hidden" name="_config" value="foo">

So, instead, make it user selectable.

<label for="subject">Subject:</label>
<select class="form" id="subject" name="_config">
<option value="membership">membership</option>
<option value="webmaster">webmaster</option>
<option value="etc">etc</option>
</select></div>

Create separate configuration files for each option. In each
configuration file, you can define a recipient and subject, among lots
of other things. If you need help setting this up, let me know. I'm
heading out of town (to Seattle, Washington, US), but I should have
Internet access there.

--
Brian (remove "invalid" from my address to email me)
http://www.tsmchughs.com/
Jul 20 '05 #16

P: n/a
On Mon, 23 Feb 2004 07:57:06 -0600, kaeli wrote:
In article <op**************@news.rcn.com>, ne*****@spamrcn.com
enlightened us with...

Is it possible to do
<something emaily>
Sure. .... If you want the server-side solution,
Oooh! yes please, I need a general,
'no attachments' email solution.
..tell me which language you're
using. :)


JSP, also have access (legal'n'all)
to the O'Reilly 'standard' jar if
required.

--
Andrew Thompson
* http://www.PhySci.org/ Open-source software suite
* http://www.PhySci.org/codes/ Web & IT Help
* http://www.1point1C.org/ Science & Technology
Jul 20 '05 #17

P: n/a
In article <ew*****************************@40tude.net>,
Se********@www.invalid enlightened us with...
On Mon, 23 Feb 2004 07:57:06 -0600, kaeli wrote:
In article <op**************@news.rcn.com>, ne*****@spamrcn.com
enlightened us with...

Is it possible to do

<something emaily>
Sure.

...
If you want the server-side solution,


Oooh! yes please, I need a general,
'no attachments' email solution.
..tell me which language you're
using. :)


JSP, also have access (legal'n'all)
to the O'Reilly 'standard' jar if
required.

I use
<%@ page import="sun.net.smtp.SmtpClient" %>

I think that comes with JSP. If not, it's downloadable.

Here's the part of my page that mails. Edited for sensitive content for
Usenet. Note: some variables defined elsewhere, but I think you get the
drift.

--------------------------

// if no errors, we got it all - mail it.
SmtpClient client = new SmtpClient("serverAddy.com");
client.from("se****@serverAddy.com");
client.to(to);
PrintStream message = client.startMessage();
if (type.compareTo("t_html") == 0)
{
message.println("Content-Type: text/html");
message.println("To: Users");
message.println("Subject:"+ subject);
message.println();
message.println("<p style='font-weight:bold; color:red'>Note: This
is a computer-generated message for users of the [name] system. Please
do not reply to this message.</p>");
message.println();
message.println(msg);
message.println();
message.println("<p style='font-weight:bold; color:red'>Parts or
all of this message may be <i>[company] Proprietary</i>. </p>");
}
else
{
message.println("Content-Type: text/plain");
message.println("To: Users");
message.println("Subject:"+ subject);
message.println();
message.println("################################# #######");
message.println(" This is a computer-generated message for users
of the [company] system.");
message.println(" Please do not reply to this message.");
message.println("################################# #######");

message.println();
message.println(msg);
message.println();
message.println("### Parts or all of this message may be [company]
Proprietary. ###");
}
client.closeServer();

%>

--
--
~kaeli~
A backward poet writes... inverse.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #18

P: n/a
On Wed, 3 Mar 2004 08:30:15 -0600, kaeli wrote:
Here's the part of my page that mails.


Tah muchly, saved for close scrutiny..

(..and yep, it's pretty clear.
should serve my purposes nicely)

--
Andrew Thompson
* http://www.PhySci.org/ Open-source software suite
* http://www.PhySci.org/codes/ Web & IT Help
* http://www.1point1C.org/ Science & Technology
Jul 20 '05 #19

P: n/a
In article <1t*******************************@40tude.net>,
Se********@www.invalid enlightened us with...
On Wed, 3 Mar 2004 08:30:15 -0600, kaeli wrote:
Here's the part of my page that mails.


Tah muchly, saved for close scrutiny..

(..and yep, it's pretty clear.
should serve my purposes nicely)


Welcome!

--
--
~kaeli~
Going to church doesn't make you a Christian any more than
standing in a garage makes you a car.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #20

This discussion thread is closed

Replies have been disabled for this discussion.