Click to See Complete Forum and Search --> : bformmail - dynamic subject line


Ligia
12-02-2005, 02:19 AM
Hello all,

I have a feedback form based on bformmail.cgi. I need to have the subject line identical with the value of the radio button that is selected by the user.

For example, if the user checks this: <input name="position" type="radio" value="Production Intern">, the recipient should receive an email with the subject: Production Intern.

Is that possible?

Thanks!
Ligia

kelly23
12-02-2005, 05:29 AM
Hi,

You could do something like this:

In the head place:


<script type="text/javascript">
function getSelectedRadioButton() {
var pos="";
for (i=0; i < document.form1.position.length; i++ ) {
if (document.form1.position[i].checked) {
pos = document.form1.position[i].value;
document.form1.subject.value=pos;
document.form1.submit();
}
}
}
</script>


. . . and in the body place:


<form name="form1" action="/path-to-bformmail.cgi" method="POST" onSubmit="getSelectedRadioButton()">
<input type="hidden" name="subject" value="">
Position: <br>
<input name="position" type="radio" value="Production Intern"> Production Intern<br>
<input name="position" type="radio" value="Administrative Assistant"> Administrative Assistant<br>
<input name="position" type="radio" value="Web Developer"> Web Developer<br><br>
<input type="submit" value="Submit"></form>


Of course, this solution relies on javascript being turned on in the user's browser.