...

View Full Version : JS and FormMail



Dr.T.
11-21-2010, 05:32 PM
Hi!

Google groups emails by “Subject.” Unfortunately, there is no way to keep emails with the same “Subject” separate. I am using FormMail to receive comments and questions from viewers. Before, I was specifying the “Subject” as “Comments/Questions.” Therefore, Google grouped all the emails. And, I wanted to keep the email separate.

To separate the emails, I changed the code as follows:

<script>

function is_filled()

{

[Here is some of the code used for validation which works fine!]

}

var subject_random="CQ" + Math.floor(Math.random)()+999999) + 1; [Here I set the

variable]

</script>

Then in FormMail, I show:

<input type="hidden" name="subject" value=subject_random>

When the form is submitted, the Subject in the email appears as “subject_random.”

Please help!

Thank you.

Dr. T.

Old Pedant
11-21-2010, 10:06 PM
You'd have to do

document.write('<input type="hidden" name="subject" value="' + subject_random + '">');

to create that field.

Or, if the field already exists, you could do

document.forms[0].subject.value = subject_random;

But that must be done *AFTER* the </form> tag is processed by the browser. So either put the JS at the end of the page or use <body onload="..."> to do it.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum