You are viewing limited content. For full access, please sign in.

Question

Question

Can you create a test, that will auto score in Forms?

asked on April 14, 2015

We would like to have our employees complete our certification program and have the test filed away in their employee folder, with results emailed to their managers.

I know i can create a test in forms, but can i have a way to score thier answers?

0 0

Answer

SELECTED ANSWER
replied on April 15, 2015

If you are referring to a multiple choice exam, see the following example.

Here is a sample exam in the form editor:

Some things to point out are that the questions are just standard radio button fields. In my example, the radio button choices have values assigned to them: 0 for the incorrect choice and 5 for the correct choice. The two radio button fields are also using the CSS class, radiobutton. The Score field is to calculate the sum and uses the CSS class, radiosum. The Status field is to display a simple "Pass" or "Fail" based on what the Score is. This field uses the CSS class, pf.

Below is the CSS and JavaScript I'm using to hide the Score and Status fields from the test taker and to do the score/status calculations.

From this, as long as one out of two questions are answered correctly, then it's considered a Pass. I left out the details regarding capturing who is taking the exam and finding this person's manager, but the basic process after the user takes the test and submits it is that it will get stored into the repository and then separately I have a Workflow that monitors for new documents and then gets the score and status and emails that to the manager. Note that the copy of the form that's saved into the repository under the user's folder will not show their score or status. All they would see is something like

If you wanted the copy in the repository to display the score and status, then that's possible as well. Just make a copy of the form and remove the CSS so that it doesn't hide the score and status fields. In the Forms business process modeler's Save to Repository service task, just use the copy of the form with the fields displayed.

1 0

Replies

replied on April 15, 2015 Show version history

You could attempt something similar to this though the workflow would be very long. I'm not sure if there is a way to go through all the retrieved field values. Essentially you would retrieve all the values from the form. Create a score token and a total score token. Then in the conditional you would put the condition if they were to have the correct answer and add 1 to the score if it were to fall within the condition. You would need to repeat the area within the black bars.

Edit:

Before the assigning the score you can have a another token calculator to do current score/total score and then store that in an additional field in the assign score activity that is in the image.

1 0
replied on April 15, 2015

You could accomplish this in Forms using JavaScript if after the test is submitted it is assigned to someone. After the form is submitted have a second form that adds the fields with the correct answers. Then have JavaScript that compares to the two fields. For each question you would then have a 3rd field that puts in a 1 or a zero. You could then calculate those fields and come up with the total score. Then in Forms you could have the workflow decide whether it needs to go to a manager or not based on the total value of the score.

0 0
replied on May 10, 2016 Show version history

When I make a question with more than 2 options, my values get changed.  For example, in a question with 4 possibilities, my values are 0,0,0,5.   After saving the form, the zeros get changed to 0, 0_1, and 0_2, respectively.  the values are then treated as non-numerical and the formula does not work.  Does anyone have any suggestions as to how I can keep these values as 0?  

0 0
replied on May 10, 2016

If your values are just going to be single digits, then you can use

sum += Number($(this).val().charAt(0));

instead of

sum += Number($(this).val().replace(/V_/g,''));

0 0
replied on May 11, 2016

I have a quiz that consists of check box questions and radio button questions.  The check box questions have several different options to check and the test taker needs to get the correct boxes checked in order to get the question right. Each question is worth 1 point.  They need to have the correct boxes checked and only the correct boxes in order to get the point.  How would I code this? 

replied on October 6, 2017

I'm trying to do something similar - I have a form with a long list of questions.  These are all radio buttons.

If a threshold is reached, another radio button should be set to "Yes".

I'm still figuring this javascript out, and I can't get anything working.  I set the css for each radio button to radiobutton, the result radiobutton to pf, and values on each radiobutton to 0 or 1 for yes or no.  

$(document).ready(function (){
  	$('.radiobutton').change(function (){
      	var sum = 0
        $('.radiobutton input:checked').each(function)(){
          	sum += Number($(this).val().replace(/V_/g,''));
        });
      
      if (sum >=1) {
        $('.pf input').val("Yes");
      }
     else
       $('.pf input').val("No");
    }
});
})

And it just stares at me blankly.

Any ideas?

0 0
replied on January 26, 2018

"And it just stares at me blankly." - Welcome to the life of a javascript programmer, anytime it get's upset, it just gives up :(

Your missing a semicolon at the end of the var sum=0 line. This tells javascript to cancel all code execution.

Here is a working code sample.

$(document).ready(function (){
  	
  var totalQuestions = 26;
  
  $('input[type=radio]').change(function (){
    try{
    
    //Count total selected 
    i = 0;     
    //Sum total correct answers  
    var sum = 0;
    
      
   $('.answer input:checked').each(function(){
     sum += parseInt($(this).val().charAt(0));
   i += 1;
   });
 
   //After all answers have been selected   
   if (i >= totalQuestions){
     //Mark pass fail
        if(sum == totalQuestions){
          $('.result input').val('Pass');
        }else{
          $('.result input').val('Fail');
        }
        
        //Set correct answers and percentage
        $('.correctAnswers input').val(sum);
        var per = Math.round((sum/26)*100);
        $('.score input').val(per+'%');
      }
    
      
 }catch(err){alert(err.message);}


  });

});

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.