Solved

Survey using radio buttons

Posted on 2000-03-24
6
255 Views
Last Modified: 2010-05-18
Here is what I have:  
I have 7 questions set up like this:
1. How would you grade our products and service?  
Radio buttons--->  A  B  C  D  F
Comments: {text box}

Okay, what I have to do is average this out.  A's = 5points; B's = 4points, etc, except that F's = 0points.   The first 6 questions need to be added up then divided by 6.  Questions 2,3,4 need to be added up and divided by 3.  Any help would be greatly appreciated.

Thanks
0
Comment
Question by:zippy221
  • 3
  • 2
6 Comments
 
LVL 3

Accepted Solution

by:
bark10 earned 75 total points
ID: 2654733
Something like this?  It can very easily be modified to your specs.

<html>

<head>
<title>New Page 1</title>
</head>

<body>

<form name="myform">
  <p>Question 1: 5<input type="radio" name="R1" onClick="choice1=5" checked>4<input
  type="radio" name="R1" onClick="choice1=4">3<input type="radio" name="R1"
  onClick="choice1=3">2<input type="radio" name="R1" onClick="choice1=2">0<input
  type="radio" name="R1" onClick="choice1=0"></p>
  <p>Question 2: 5<input type="radio" name="R2" onClick="choice2=5" checked>4<input
  type="radio" name="R2" onClick="choice2=4">3<input type="radio" name="R2"
  onClick="choice2=3">2<input type="radio" name="R2" onClick="choice2=2">0<input
  type="radio" name="R2" onClick="choice2=0"></p>
  <p>Question 3: 5<input type="radio" name="R3" onClick="choice3=5" checked>4<input
  type="radio" name="R3" onClick="choice3=4">3<input type="radio" name="R3"
  onClick="choice3=3">2<input type="radio" name="R3" onClick="choice3=2">0<input
  type="radio" name="R3" onClick="choice3=0"></p>
  <p><input language="javascript" type="button" value="DoAve" name="ave"
  onClick="average(this.form)"></p>
</form>
</body>
<script language="Javascript1.1">
var final=0
var choice1=5
var choice2=5
var choice3=5

function average()
{
      final=((choice1 + choice2 + choice3)/3);
      alert(final)
}
</script>

</html>
0
 

Author Comment

by:zippy221
ID: 2654823
Adjusted points from 50 to 75
0
 

Author Comment

by:zippy221
ID: 2654824
Okay well let's say, instead of, a "Do Avg" button I wanted a submit button and it would check for every question that was below a B rating and email it to someone, and then according to the average it was submitted to a certain database.  Example: Good Average Database or Bad Average Database.  Also, if on the survey a person gave all A's then that would be emailed upon submission to someone else. If you don't know, then don't worry about it, I just thought I would ask while I was here :)

Thanks
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 4

Expert Comment

by:brigmar
ID: 2655123
That sort of functionality is definitely better performed by the (server side)script that processes the form, rather than at the client submitting it.

Brian
0
 

Author Comment

by:zippy221
ID: 2655169
So, is it possible to put server-side script inside my client-side script?  ....  
0
 
LVL 4

Expert Comment

by:brigmar
ID: 2655230
I think you misunderstand :

The <FORM> is used to submit details to a web server.

You fill out the form, press 'submit', and the details are sent to the server. A 'script' running on the server reads those details, performs whatever it needs to perform, and then sends a page back to you.

It is this 'script' that should perform the emailing.

You can't embed server script and client script together. Server script is processed by the server before sending the page to the client. Client script is processed by the client after the page has transferred to the client.
Clients never 'see' server side script.
Servers 'see' client side script only insofar as they 'see' the whole document. But to the server, it is all just HTML text.

Brian
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Generate Numbers in JQuery file 11 66
VBScript on Html 15 48
jQuery force form POST 7 50
ASP.NET Content Page 3 33
Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

830 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