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

Question

Question

Value of jquery script not being passed to database.

asked on April 28, 2017

I have a table that I could not get the open formula to work (if you're interested see:  https://answers.laserfiche.com/questions/119911/Formula-to-total-number-fields-and-radio-button-values#119969 ). Giving up on that, I used a script to handle the math, which is showing the result in the "Total Score" field. But that value is not being passed and is showing up as 0.

Here's the code, and I'll attach the screen cap of the table again.

$(".score-button, .score-number").change(function(){
       var scorebuttons = 0
       var scorenumbers = 0
       $( ".score-button input:checked" ).each(function(){
		scorebuttons += Number($(this).val().replace(/V_/g,''));
});        
       $( ".score-number input" ).each(function(){
		scorenumbers += Number($(this).val().replace(/V_/g,''));
});  
  $(".score-total input").val(scorebuttons + scorenumbers)

Any ideas why the value isn't being passed?

2017-04-27 08_03_10-Layout _ Laserfiche Forms.png
0 0

Replies

replied on April 28, 2017

You have a couple syntax errors.  Try this:

$(document).ready(function() {
  $(".score-button, .score-number").on('change', function(){
    var scorebuttons = 0
    var scorenumbers = 0
    $( ".score-button input:checked" ).each(function(){
	  scorebuttons += Number($(this).val().replace(/V_/g,''));
    });
    $( ".score-number input" ).each(function(){
	  scorenumbers += Number($(this).val());
    });
    $(".score-total input").val(scorebuttons + scorenumbers);
  });
});

 

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

Sign in to reply to this post.