User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 373,933 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,179 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 377 | Replies: 2
Reply
Join Date: Mar 2008
Posts: 1
Reputation: mjs301 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mjs301 mjs301 is offline Offline
Newbie Poster

Help Help!

  #1  
Mar 12th, 2008
I'm hoping one of you javascript guru's can help me because i'm new at javascript!!!
I need to return the score from my function and have it emailed with the test results. How do i do it?
here is the code: (i know it's mickey mouse but it took me a while to get it to work)
<html><head>
<title>Introduction to Disease Management Test</title>

<script language="javascript">

function tester() 
{

var a1 = 0; 
var a2 = 0; 
var a3 = 0; 
var a4 = 0;


for (i=0;i<document.test1Form.q1.length;i++){
if (document.test1Form.q1[i].checked){
q1value=document.test1Form.q1[i].value;

}
}
for (i=0;i<document.test1Form.q2.length;i++){
if (document.test1Form.q2[i].checked){
q2value=document.test1Form.q2[i].value;

}
}
for (i=0;i<document.test1Form.q3.length;i++){
if (document.test1Form.q3[i].checked){
q3value=document.test1Form.q3[i].value;

}
}
for (i=0;i<document.test1Form.q4.length;i++){
if (document.test1Form.q4[i].checked){
q4value=document.test1Form.q4[i].value;

}
}

if(q1value=="d")    {a1 = 1;} 
if(q2value=="d")    {a2 = 1;} 
if(q3value=="b")    {a3 = 1;} 
if(q4value=="e")    {a4 = 1;} 


total = a1 + a2 + a3 + a4; 

grade = 25*total; 


if (total < 100) { alert("Your score is "+ grade +"%."); }

return grade;


} 
</script> 

</head>

<body> 

<FORM name="test1Form" action="xxxxxxxxxxxxxx" method="post" target="_top" onSubmit="tester()">
<INPUT type="hidden" value="xxxx@xxx.xxx" name="recipient">
<INPUT type="hidden" value="Intro to DM Test" name="subject">
<INPUT type="hidden" value="http:/xxxxxxxxxxx/" name="redirect">
<INPUT type="hidden" name="env_report" VALUE="REMOTE_HOST,HTTP_USER_AGENT">
<INPUT type="hidden" name="print_blank_fields" VALUE="1">
<INPUT type="hidden" name="required" value="name,date,department,license,q1,q2,q3,q4">

<!--<form method=post enctype="text/plain" action="mailto:xxxxx@xxxx.xxx">-->

<h3>CONTINUING EDUCATION COURSE TEST</h3><br>



<p>
Name:<input type="text" name="name" size=50><br>
Date:<input type="text" name="date"><br>
Department:<input type="text" name="department" size=54><br>
License # (Required for RNs, LVNs & OTs): <input type="text" name="license"></p>

<p><b>DIRECTION: Choose the BEST answer.</b></p>
<p>
<br><b>1. Which of the following are key aspects of a home care disease management program?</b>
<br><input type="radio" name="q1" value="a">a)	It emphasizes prevention of exacerbations and complications of chronic diseases.
<br><input type="radio" name="q1" value="b">b)	It uses strategies to empower the patient to understand and manage their own chronic diseases.
<br><input type="radio" name="q1" value="c">c)	It involves the coordination of healthcare interventions to manage a patient’s chronic diseases.
<br><input type="radio" name="q1" value="d">d)	All of the above
<br>
<br><b>2. Which of the following conditions would not be appropriate for a home care disease management program?</b>
<br><input type="radio" name="q2" value="a">a)	Congestive Heart Failure
<br><input type="radio" name="q2" value="b">b)	Diabetes
<br><input type="radio" name="q2" value="c">c)	Hip replacement
<br><input type="radio" name="q2" value="d">d)	Home IV antibiotics for pneumonia
<br><input type="radio" name="q2" value="e">e)	Chronic Obstructive Lung Disease
<br>
<br><b>3. Key outcomes expected from a home care disease management program include all the following except?</b>
<br><input type="radio" name="q3" value="a">a)	Reduced emergency room visits
<br><input type="radio" name="q3" value="b">b)	Less reliance on physicians
<br><input type="radio" name="q3" value="c">c)  Avoidance of unplanned hospitalizations
<br><input type="radio" name="q3" value="d">d)	Improved clinical outcome measures
<br><input type="radio" name="q3" value="e">e)	Improved patient satisfaction

<br>
<br><b>4. Patient self-management is a central component of a home care disease management program.  Home care agencies have clear advantages in promoting and assessing patient self-management education because of all the following except.</b>

<br><input type="radio" name="q4" value="a">a)	The patient is more comfortable and less anxious at home, creating a better environment for education
<br><input type="radio" name="q4" value="b">b)	Trust and confidence develops in the home care clinician over time because of repeated visits
<br><input type="radio" name="q4" value="c">c)	Home care staff are in a position of being able to observe the patient’s understanding of specific intervention activities
<br><input type="radio" name="q4" value="d">d)	Home care staff get an insight into the patient’s issues that might lead to non-adherence to specific treatment guidelines.
<br><input type="radio" name="q4" value="e">e)	Patient’s are more captive in the homes and therefore feel obligated to follow the home care staff’s recommendations.




<br>
 
<br> <input type="submit" value="Submit Test">

</p>
 
</body>
</html>
Last edited by MattEvans : Mar 13th, 2008 at 5:44 am. Reason: Please use [ code ] tags around large blocks of code.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2007
Location: georgia
Posts: 55
Reputation: hunkychop is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 4
hunkychop's Avatar
hunkychop hunkychop is offline Offline
Junior Poster in Training

Re: Help!

  #2  
Mar 12th, 2008
if you want to have the script email the results, it would probably be easier and safer to use a server side script like PHP . i could be wrong but, i dont even think javascript will send emails.
toast
Reply With Quote  
Join Date: Jan 2008
Location: Bangalore, India
Posts: 327
Reputation: DangerDev is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 31
DangerDev's Avatar
DangerDev DangerDev is offline Offline
Posting Whiz

Re: Help!

  #3  
Mar 13th, 2008
<html>
<head>
 <script>
   function sendMail()
   {
		var mailId="you@yourmail.com";
		var subject="subject you want";
		var cc="cc@other.com";
		parent.location="mailto:"+mailId+"?subject="+subject+"&cc="+cc;
	}
 </script>
</head>
<body>
<a href="javascript:sendMail()">mail someone</a>
</body>
</html>
above code will open the default email client of the user (e.g. Outlook Express, etc.).

as hunkychop^ said, it will be good idea to use server side script to send the mail.
send data to the server by some means (either by form submit or by ajax) and their you form mail body and send mail.
A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila.
~Mitch Ratcliffe
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 6:17 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC