-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsatisfaction.js
44 lines (39 loc) · 1.21 KB
/
satisfaction.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
*
* @param root_doc
* @param id
*/
function plugin_satisfaction_load_defaultvalue(root_doc, default_value){
var value = $('input[name="default_value"]').val() || Math.floor((default_value/2).toFixed(0));
if(value > default_value) {
value = default_value;
}
$.ajax({
url: root_doc+'/ajax/satisfaction.php',
type: 'POST',
data: '&action_default_value&default_value='+ default_value + '&value=' + value,
dataType: 'html',
success: function (code_html, statut) {
$('#default_value').html(code_html);
},
});
}
/**
* Launch the interaction implementation of numeric_scale_with_nc
*/
function registreNumericScale() {
(function(){
document.querySelectorAll('.numeric_scale_with_nc[required]')
.forEach(function(question) {
question.querySelectorAll('input[type="radio"]')
.forEach(function(answere) {
answere.addEventListener('change', function() {
question.setAttribute('data-valid', 'true');
});
if(answere.checked)
question.setAttribute('data-valid', 'true');
});
});
})();
}
window.addEventListener('load', registreNumericScale);