$(‘#_AIR_AKTIEF_AAND’).select2({disabled: true});
Javascript – Building arrays for Chart.js from JSON data
function getPerformanceinfo (){
var myLabelarray = [];
var myActualarray = [];
$.post(‘inl_sev_078_J_vrs.php’, {“UNIQUENO” : myReportref }, function(response) {
for(var i=0; i<response.length; i++) {
myLabelarray[i] = response[i]._TAK;
myActualarray[i] = response[i]._PERCENTAGE;
}
$(“#_UNIQUENUMBER”).prop(“disabled”, true);
myChartjs (myLabelarray, myActualarray);
}, ‘json’)
}
// — Parameters input ——————————————————–
$uniqueno = (isset($_REQUEST[‘UNIQUENO’])) ? $_REQUEST[‘UNIQUENO’] : ”;
// — Define containers ——————————————————-
$terugvoer = array();
$tmp = array();
// — Extract the category names and weights ——————————
$sql = “SELECT _QUESTIONNAIRE, _VERSION, _TAK, _PERCENTAGE FROM performance WHERE _UNIQUENO = ‘$uniqueno’ “;
$db = new MysqliDb(‘CES’);
$selectStatus = $db->rawQuery($sql);
foreach ($selectStatus as $row) {
$tmp[‘_TAK’] = $row[‘_TAK’];
$tmp[‘_PERCENTAGE’] = $row[‘_PERCENTAGE’];
$terugvoer[] = $tmp;
}
// echo ‘<pre>’;
// print_r($terugvoer);
// echo ‘</pre>’;
echo json_encode($terugvoer);
JQuery – Disabling Select2
$(“#_UNIQUENUMBER”).prop(“disabled”, true);
PHP – Hyperlinks and images
foreach ($myArray as $key => $value) {
$myURL = substr($myArray[$key][‘path’], 5);
$mySafeURL = str_replace(‘ ‘, ‘%20’, $myURL);
$mysrc = $myEnv . $mySafeURL;
if (substr($mysrc, -3) == ‘pdf’ || substr($mysrc, -3) == ‘PDF’) {
// — PDF Document —————————————–
echo “<a href=” . $mysrc . “>PDF Dokument / Document</a>”;
} else {
// — JPG or PNG ——————————————-
echo “<img width=’30% height=’30%’ src=” . $mysrc . ” onclick=window.open(this.src)>”;
}
echo “<hr>”;
}
Javascript – Building arrays from JSON response data
function getPerformanceinfo (){
var myLabelarray = [];
var myActualarray = [];
$.post(‘inl_sev_078_J_vrs.php’, {“UNIQUENO” : myReportref }, function(response) {
for(var i=0; i<response.length; i++) {
myLabelarray[i] = response[i]._TAK;
myActualarray[i] = response[i]._PERCENTAGE;
}
myChartjs (myLabelarray, myActualarray);
}, ‘json’)
}
// — Parameters input ——————————————————–
$uniqueno = (isset($_REQUEST[‘UNIQUENO’])) ? $_REQUEST[‘UNIQUENO’] : ”;
// — Define containers ——————————————————-
$terugvoer = array();
$tmp = array();
// — Extract the category names and weights ——————————
$sql = “SELECT _QUESTIONNAIRE, _VERSION, _TAK, _PERCENTAGE FROM performance WHERE _UNIQUENO = ‘$uniqueno’ “;
$db = new MysqliDb(‘CES’);
$selectStatus = $db->rawQuery($sql);
foreach ($selectStatus as $row) {
$tmp[‘_QUESTIONNAIRE’] = $row[‘_QUESTIONNAIRE’];
$tmp[‘_VERSION’] = $row[‘_VERSION’];
$tmp[‘_TAK’] = $row[‘_TAK’];
$tmp[‘_PERCENTAGE’] = $row[‘_PERCENTAGE’];
$terugvoer[] = $tmp;
}
// echo ‘<pre>’;
// print_r($terugvoer);
// echo ‘</pre>’;
echo json_encode($terugvoer);
Zebra_form – Select box
$form->add(‘label’, ‘label_uniquenumber’, ‘_UNIQUENUMBER’, “CESUniquecompnumber”);
$obj = $form->add(‘select’, ‘_UNIQUENUMBER’);
$obj->add_options($reportArray);
$obj->set_attributes(array(
‘class’ => ‘input-field control form-control’,
‘style’ => ‘width:150px’
));
$obj->set_rule(array(
));
$obj->disable_spam_filter();
JQuery – Retrieve value from Select 2
$(document).ready( function () {
$(‘select’).select2({theme: ‘bootstrap’});
$(‘#_UNIQUENUMBER’).select2(‘open’);
$(‘#_UNIQUENUMBER’).on(‘select2:select’, function (e) {
var data = e.params.data;
myReportref = data.text;
alert (“Myselection : ” + myReportref);
});
JQuery – Select 2 “Focus” or “Open”
// — On “Page load” ——————————————————–
$(document).ready( function () {
$(‘select’).select2({theme: ‘bootstrap’});
$(‘#_UNIQUENUMBER’).select2(‘open’);
});
Zebra_form – Submitting using javascript / JQuery
function zebraSubmit(){
$(‘#form1’).submit();
}
Select 2 – Retrieving the selected text
var branch = $(“#_TAK option:selected”).text();
var mydate = $(‘#_DATE’).val();
You must be logged in to post a comment.