forked from rbwatson/wlux_test_server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
study-configuration.js
48 lines (45 loc) · 1.34 KB
/
study-configuration.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
44
45
46
47
48
$(function(){
checkAutoCondition(); //Check initial state of auto condition
$('#submitbtn').click(getJSON);
$('#autoconditionid').click(checkAutoCondition); //Checks to see if the auto condition is set
});
//Query's register_config.php to get JSON data
function getJSON () {
$.ajax('register_config.php', {
type: 'POST',
data: {
'conditionId': $('#conditionId').val(),
'cssURL': $('#cssURL').val(),
'taskBarCSS': $('#taskBarCSS').val(),
'buttonText': $('#buttonText').val(),
'returnURL': $('#returnURL').val(),
'taskText': $('#taskText').val(),
'taskHTML': $('#taskHTML').val(),
'tabShowText': $('#tabShowText').val(),
'tabHideText': $('#tabHideText').val()
},
success: jsonSuccess
});
}
/* Determins weather the auto condition id is set and disables the ID and css fields in the form
* if the condition box is checked. If box is unchecked all fields will be available
*
*/
function checkAutoCondition (argument) {
// body...
var condition = $('#conditionId');
var css = $('#cssURL');
if($('#autoconditionid').attr('checked')){
condition.attr("disabled", "true");
condition.removeAttr("value");
css.attr("disabled", "true");
css.removeAttr("value");
} else {
condition.removeAttr('disabled');
css.removeAttr('disabled');
}
}
function jsonSuccess (response) {
// body...
alert('configuration created');
}