vendredi 9 janvier 2015

Google form apps, assign checkbox value

I have a simple google form that I'm writing that has checkboxes with values that aren't numerical, but I'd like to assign them numerical values if they are checked. For example,


Please check your grades Grades


[__] A


[__] B


[__] C


[__] D


[__] F


Each of these would be set up using a method similar to



var item = form.addCheckboxItem();
item.setTitle('Please check your Grades');
item.setChoices([
item.createChoice('A'),
item.createChoice('B'),
item.createChoice('C'),
item.createChoice('D'),
item.createChoice('F')
]);


If I wanted to add up a numerical value for each box selected, for example, if


A = 4


B = 3


C = 2


D = 1


F = 0


And the user selected A, and C, then I would like a button that would calculate the value and have a popup box of some kind that gave the sum. So in the scenario where the user selected A and C, they would click a calculate button, and the number 6 would appear.


Checkboxes in javascript have a value area, but I haven't seen anything for the google forms that does that. Also, I've seen people say that you could cycle through and check if each checkbox's value is true, and if it is true, check a dictionary where you assign A to 4, and so on. That seems kind of messy, but I haven't found anything better. Any help is appreciated.





Aucun commentaire:

Enregistrer un commentaire