Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Form that totals correct answers How To

Posted on 2007-11-24
2
Medium Priority
?
179 Views
Last Modified: 2013-12-24
Hi all,

I would like to create a form in FP2003 that will allow users to input values to a sum, then when they are complete taking the quiz click on the Check button. Beside this button a box will display how many of the sums they got correct.

I played around and set the validation options in the text box area to look for a specific value, but dont know how to incorporate this into the total Correct box.

Thanks for your help in advance guys.

Kevin
<!--webbot bot="Validation" S-Data-Type="Number" S-Number-Separators=",." S-Validation-Constraint="Equal to" S-Validation-Value="3025" -->
 
 
As an example of what I did to set validation for the sum 55 X 55

Open in new window

0
Comment
Question by:oconnork00
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Accepted Solution

by:
brundo earned 2000 total points
ID: 20356274
Hi,

there are two problems with validation:
- it validates only if the result is correct, but doesn't add the points for your quiz
- you don't see the script which will validate your field content until publishing
  (this is what the webbot from your code snippet does).

So, you have to write your script. Let us assume you users have JavaScript enabled
(what the majority, but not all users have).

Below is the page with script - you can create a new page and copy the whole
content in your code view instead of generated content. Then show the page in
browser and test it by entering new values.

There is a lot of place for improvement, but I would first check the idea is good for you.

If it is ok, try to read and understand the script... then, try to make a new addition
exercise with new numbers. If it is ok, then you should define what you need and solve
problem by problem. Or ask further :-))
<html>
 
<head>
<title>Addition test</title>
 
<script language="javascript" type="text/javascript">
 
	points = 0;
	
	function check (field,number) {
	
	   tmpelement = document.getElementById("T" + field);
	   tmpelement.disabled = true;
	   
	   if (tmpelement.value == number) {
	   
	   		tmpelement = document.getElementById("points");
	   		points += 1;
	        tmpelement.value = points;
	        
	        tmpelement = document.getElementById("R" + field);
	   		tmpelement.value = ":-))";
	   		
	   } else {
	   
	        tmpelement = document.getElementById("R" + field);
	   		tmpelement.value = ":-((";   
	   		
	   }
	}
</script>
 
</head>
 
<body>
 
<form name="test" method="POST" action="maybeSomeActionAfterTheQuiz;">
	<blockquote>
 
		<p>5 + 1 = 
		   <input type="text" id="T1" size="5" onchange="check(1,5+1);"> 
		   <input type="text" id="R1" size="5" disabled="true"></p>
		<p>5 + 3 = 
		   <input type="text" id="T2" size="5" onchange="check(2,5+3);"> 
		   <input type="text" id="R2" size="5" disabled="true"></p>
 
		<p>Total: <input type="text" id="points" size="5" disabled="true" value="0"></p>
 
	</blockquote>
</form>
</body>
 
</html>

Open in new window

0
 
LVL 2

Author Comment

by:oconnork00
ID: 20385823
Hi Brundo,

Exactly what I was looking for, thank you.

Kevin
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
The purpose of this video is to demonstrate how to create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and SmallPDF.com Log…
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…
Suggested Courses

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question