Skip to content

Commit

Permalink
bei eingereichtem Fragebogen sind Antworten nicht mehr klickbar
Browse files Browse the repository at this point in the history
  • Loading branch information
ged-de committed Aug 15, 2015
1 parent 7ec5afc commit d8bfee9
Showing 1 changed file with 65 additions and 53 deletions.
118 changes: 65 additions & 53 deletions js/survey_functions.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ $(document).ready(function() {
// $('#invisible_topics_inputs').hide();




//get the widths of all navigation li's
var menuWidths = $('#accordion li').map(function(i) {
//document.getElementById('foo').offsetWidth
Expand Down Expand Up @@ -33,40 +35,6 @@ $(document).ready(function() {
});



// Drag & Drop the topics/objects to sort them
$('.sortable_topics').sortable({
axis: 'y',
stop: function (event, ui) {
var data = $(this).sortable('serialize');
//$('span#order').text(data);

$('#invisible_topics_inputs').find('input').remove();
createTopicInputs();

/*$.ajax({
data: oData,
type: 'POST',
url: '/your/url/here'
});*/
}
});

// create hidden Inputs of Topics to write the order of Topics to db with $_POST method
function createTopicInputs(){
var sortedIDs = $( ".sortable_topics" ).sortable( "toArray" );
$.each(sortedIDs, function(index, value){
$('<input type="text" name="'+ value +'"/>').val(index +1).appendTo('#invisible_topics_inputs');
});
}
createTopicInputs();


// write to hidden inputs to mark range-inputs as valid when they get clicked
$('.gf_range_inputs').click(function(){
$('input[name="'+ $(this).prop('name')+'_valid"]').val(1);
});



// if no survey_warnings appear - remove the ccs class "noAnswer" from questions(with radiobuttons) without answer.
Expand All @@ -77,30 +45,74 @@ $(document).ready(function() {
});
}

// clickable wraper for input radios // Fragebogen
$(".select-area").click(function() {
var name = $(this).find('input:radio').attr('name');
$('input[name="'+ name +'"]').parent().removeClass('selected_label');
$('input[name="'+ name +'"]').parent().parent().removeClass('noAnswer');
$(this).addClass('selected_label');
$(this).find('input:radio').prop('checked', true);
});

// if the questionnaire still available but the answers already submited
if($('#commited_view').length){
$('table.responsive-table').find('input, select').prop('disabled', true);
}else{
// clickable wraper for input radios // Fragebogen
$(".select-area").click(function() {
var name = $(this).find('input:radio').attr('name');
$('input[name="'+ name +'"]').parent().removeClass('selected_label');
$('input[name="'+ name +'"]').parent().parent().removeClass('noAnswer');
$(this).addClass('selected_label');
$(this).find('input:radio').prop('checked', true);
});

// Drag & Drop the topics/objects to sort them
$('.sortable_topics').sortable({
axis: 'y',
stop: function (event, ui) {
var data = $(this).sortable('serialize');
//$('span#order').text(data);

$('#invisible_topics_inputs').find('input').remove();
createTopicInputs();

/*$.ajax({
data: oData,
type: 'POST',
url: '/your/url/here'
});*/
}
});

// manipulate grades on change
$( '#grade1' ).change(function() {
var grade1 = $(this).val();
$('#grade3 option').prop('selected', false)
.filter('[value="' + grade1 + '"]')
.prop('selected', true);
// create hidden Inputs of Topics to write the order of Topics to db with $_POST method
function createTopicInputs(){
var sortedIDs = $( ".sortable_topics" ).sortable( "toArray" );
$.each(sortedIDs, function(index, value){
$('<input type="text" name="'+ value +'"/>').val(index +1).appendTo('#invisible_topics_inputs');
});
}
createTopicInputs();

$('#grade3 option').each(function(){
if($(this).val() < grade1){
$(this).attr('disabled',true);
}

// write to hidden inputs to mark range-inputs as valid when they get clicked
$('.gf_range_inputs').click(function(){
$('input[name="'+ $(this).prop('name')+'_valid"]').val(1);
});
});




// manipulate grades on change
$( '#grade1' ).change(function() {
var grade1 = $(this).val();
$('#grade3 option').prop('selected', false)
.filter('[value="' + grade1 + '"]')
.prop('selected', true);

$('#grade3 option').each(function(){
if($(this).val() < grade1){
$(this).attr('disabled',true);
}
});
});
}






});

0 comments on commit d8bfee9

Please sign in to comment.