Fandelem
01-24-2001, 08:41 PM
i have finally made a javascript form/quiz - and it works.. calculates the score and whatnot.. but then i'm stumped when i try to get it to send it.
my question: how does javascript integrate with .cgi scripts?
well, more specific, i was originally using FormMail.pl to have my html forms processed via .cgi, but I couldn't figure out how to get it to calculate and whatnot, based on the input boxes.. etc.. bottom line: I want it to calculate it in html, using javascript, which has been accomplished. it puts it in the variable "score" - but now how do i get this emailed to me, along with a few other things like their email, name, etc?
actually, what is happening is i have:
<form name="quiz">
//all of my inputs and questions, etc
<input type="button" value="Get score" onClick="getScore(this.form)">
<input type="reset" value="Clear"><p>
Score = <input type=text size=15 name="percentage"><br>
//this works- it calculates the score from
//a predefined function.
</form>
<FORM ACTION="http://www.fandelem.com/cgi-bin/FormMail.pl" METHOD="POST">
Please enter your Email:<br> <INPUT name="email"> <BR>
Please enter your Name:<br> <INPUT name="realname"> <BR>
<br><input TYPE="submit" value="Send Form"><input TYPE="reset" value="Reset Form">
</form>
however, when i try to do this, it will only send the email, and name, it won't send the score.. ok, i guess my real question is, how do i include their score in the next form? - it is still stored in the variable "score" - but how do i make it it appear on my email?
any insight would be great http://www.linuxnewbie.org/ubb/smile.gif i just spend horus fiddling around with this hehe.. ah well, i've learned a bunch too though http://www.linuxnewbie.org/ubb/smile.gif
~kyle
---edit
okay, i think it lies in the:
<input type="hidden" name="score" onSubmit="getScore(this.form)">
if someone can point me in the right direction on how to get it to do the calculation like that.. then FormMail.pl will process it just like any other input.. how do I access the javascript function from an <input type> ? or what would be the best way to go about this?
[This message has been edited by Fandelem (edited 24 January 2001).]
my question: how does javascript integrate with .cgi scripts?
well, more specific, i was originally using FormMail.pl to have my html forms processed via .cgi, but I couldn't figure out how to get it to calculate and whatnot, based on the input boxes.. etc.. bottom line: I want it to calculate it in html, using javascript, which has been accomplished. it puts it in the variable "score" - but now how do i get this emailed to me, along with a few other things like their email, name, etc?
actually, what is happening is i have:
<form name="quiz">
//all of my inputs and questions, etc
<input type="button" value="Get score" onClick="getScore(this.form)">
<input type="reset" value="Clear"><p>
Score = <input type=text size=15 name="percentage"><br>
//this works- it calculates the score from
//a predefined function.
</form>
<FORM ACTION="http://www.fandelem.com/cgi-bin/FormMail.pl" METHOD="POST">
Please enter your Email:<br> <INPUT name="email"> <BR>
Please enter your Name:<br> <INPUT name="realname"> <BR>
<br><input TYPE="submit" value="Send Form"><input TYPE="reset" value="Reset Form">
</form>
however, when i try to do this, it will only send the email, and name, it won't send the score.. ok, i guess my real question is, how do i include their score in the next form? - it is still stored in the variable "score" - but how do i make it it appear on my email?
any insight would be great http://www.linuxnewbie.org/ubb/smile.gif i just spend horus fiddling around with this hehe.. ah well, i've learned a bunch too though http://www.linuxnewbie.org/ubb/smile.gif
~kyle
---edit
okay, i think it lies in the:
<input type="hidden" name="score" onSubmit="getScore(this.form)">
if someone can point me in the right direction on how to get it to do the calculation like that.. then FormMail.pl will process it just like any other input.. how do I access the javascript function from an <input type> ? or what would be the best way to go about this?
[This message has been edited by Fandelem (edited 24 January 2001).]