Options for Form Mail?


#1

HI … I’d like to enable a couple of options in a form that I have, and am wondering if it’s possible with the Dreamhost CGI.

1./ I would like to have an extra mandatory field IF a user chooses a specific option in the drop down. For example, if a user chooses OTHER, I want the DESCRIPTION field to be mandatory. Otherwise, I don’t want it to be. Can I do this?

2./ I would like an email to be sent to varying individuals, based on user input. If user chooses option A, the email goes to recipient A. Option B goes to recipient B, etc. Can this be done?

If either of these can be done, can someone send me the syntax for it?


#2

Neither of the situations you describe are available with the stock formmail script provided by Dreamhost (http://formmail.dreamhost.com).

I suppose you could cobble together some javascript called from within your form to manipulate your variables depending upon the conditions you describe, and pass the “processed” variables to the script, but I don’t see that as trivial (especially if you are not a javascript programmer!).

–rlparker


#3

I am not sure I understand what you want to do but as far as part two is concerned. I think you want a form whereby instead of sending to a single hard-wired email recipient you want the person who fills in the form to select the email recipient.

You can do this with a drop-down menu in HTML.

In a normal form I would have the line:-

You only need one name value to be set to ‘recipient’ ,as the only required name value,to get the DreamHost formmail working.

So use a select setting like:-

Andrew Bob Charlie Doris Eric

You would need to know the email recipients in advance and add the email aliases ( a,b,c,d,e in this example) to your account if they were local to your domain.
Eric above is selected as a default. The user then selects the email recipient from the drop-down.

Do not forget though… If the email address is within the same domain as the form is called from you can omit the domain part of the address. If your email recipients are outside your domain you need to use the full email address which of course is then open to email address harvesters.

I am still re-re-re-reading your option one. :slight_smile: You may have to resort to javascript as rlparker has said above.


Norm

Opinions are my own views, not DreamHosts’.
I am NOT a DreamHost employee OK!! :@

You act on my advice at your own risk!


#4

That’s a “good catch”, Norm! Your suggestion ought to meet the requirements for his second circumstances very nicely (especially if he builds his “options” as the input prompts, and the “emails” as the passed values. I just “brain farted” on that one! Thanks!

–rlparker


#5

Now for your option one I am making this up. :slight_smile:

If your drop down name TEST has the value of OTHER which you want to make mandatory then some ‘javeryscripty’ like:-

(Which is supposed to say “If Test = Other and Description is blank throw up the alert”

Will need a javerscripter to correct it though!!! )

Remember I made this up so no sniggering at the back of the class please.

All I can say is “…along these lines.” :slight_smile:

I am not sure if the return true; bit is needed or not so I threw it in anyway!


Norm

Opinions are my own views, not DreamHosts’.
I am NOT a DreamHost employee OK!! :@

You act on my advice at your own risk!


#6

HI NORM and RL - Thanks for your replies. As far as option one, I don’t just want the user to choose the recipient … rather, I want the user to choose the subject, and I will hard-code the recipient from there.

For example, if the form shows “What Team is this About?” and the options are Basketball, Baseball and Football … if the user chooses Basketball, I want the form to automatically route (recipient) to the Basketball coach. Baseball questions will go to the Baseball coach, etc.


#7

Now I am confused (which is easy to do). Do you mean option two in your reply? Either way it does not matter because the select drop down does that for you with a paired name and value. So you would have the sports where I have the peoples names and you can still put in the email addresses where I have them:-

Baseball Basketball Football anothersport Conkers

You can see how I have tacked (literally) in the select drop-down to a feedback-form I had doing nothing at my web-site. (Click the ‘o’ in my name and add on /forms/form.html).

Come back if I still have not grasped it. I usually need about ten goes to get the question right. :slight_smile:


Norm

Opinions are my own views, not DreamHosts’.
I am NOT a DreamHost employee OK!! :@

You act on my advice at your own risk!


#8

Sorry if I confused … it’s definitely not you, it’s my inability to explain … let me try this way.

At http://www.teamfurybasketball.com/form.html … two things I want to be able to do.

1./ I want to FORCE the user to complete the ‘Details’ field, if they’ve chosen ‘Other’ in the events field. I think this is the java you were talking about.

2./ I want to send the message to varying recipients, based on the events field. Right now, it’s just hard-coded to come to me. If the user chooses ‘Breakfast’, I want it to go to breakfast@teamfurybasketball.com. If the user chooses Lunch, it should go to lunch@teamfurybasketball.com, and so on.

3./ IDEALLY … it would be great if the subject line of the email would change based on the events field too. ‘Breakfast Registration’ for breakfast, ‘Lunch Registration’ for lunch, etc.