$tmp[‘_DATUM’] = $resultaat->_DATUM;
$tmp[‘_LYN’] = $resultaat->_LYN;
$tmp[‘_ZJ_LID’] = $resultaat->_ZJ_LID;
Author: edleightonprogrammer
Zebra_form template with bootstrap

PHP – Convert stdClass object to array
$myUploadinfo = $upload->getUploadDetails($uploadid);
$myUploadinfoarray = json_decode(json_encode($myUploadinfo), True);
Shift array up one level
$myArray = array_shift($myUploadinfoarray);
foreach ($myArray as $key => $value) {
$fileid = $value[‘file_id’];
$result = $upload->deleteFile($fileid);
}
The button bar

// — btnDocupload ——————————————————————–
$obj = $form->add(‘button’, ‘btnDocupload’,'<i class=”fa fa fa-save” ></i> ’ . ‘CESUpload’);
$obj->set_attributes(array(
‘class’ => ‘btn btn-success’,
‘onclick’ => ‘docUpload()’,
‘type’ => ‘button’
));
// — btnDocview ——————————————————————–
$obj = $form->add(‘button’, ‘btnDocview’,'<i class=”fa fa fa-info-circle” ></i> ’ . ‘CESViewdocs’);
$obj->set_attributes(array(
‘class’ => ‘btn btn-info’,
‘onclick’ => ‘docView()’,
‘type’ => ‘button’
));
// — btnEvaluasiestaat —————————————————————
$obj = $form->add(‘button’, ‘btnEvaluasiestaat’,'<i class=”fa fa fa-info-circle” ></i> ’ . ‘CESStaat’);
$obj->set_attributes(array(
‘class’ => ‘btn btn-info’,
‘onclick’ => ‘statementEvaluation()’,
‘type’ => ‘button’
));
// — btnPrintMyPDF ——————————————————————-
$obj = $form->add(‘button’, ‘btnPrintMyPDF’,'<i class=”fa fa fa-print” ></i> ’ . ‘CESPrintmypdf’);
$obj->set_attributes(array(
‘class’ => ‘btn btn-info’,
‘type’ => ‘button’,
‘onclick’ => ‘printPage()’,
));
The template

Populate select 2 with JSON data

function getTak (questionnaire, version) {
$(‘#_TAK’).children(‘option:not(:first)’).remove();
$.post(‘inl_sev_055_J_nvg.php’,{“QUESTIONNAIRE” : questionnaire, “VERSION” : version}, function(data) {
var i;
for (i = 0; i < data.length; i++) {
text = data[i];
newOption = new Option(text, i, false, false);
$(‘#_TAK’).append(newOption).trigger(‘change’);
}
}, ‘json’);
}
// — Parameters input ——————————————————–
$questionnaire = (isset($_REQUEST[‘QUESTIONNAIRE’])) ? $_REQUEST[‘QUESTIONNAIRE’] : ”;
$version = (isset($_REQUEST[‘VERSION’])) ? $_REQUEST[‘VERSION’] : ”;
// — Define containers ——————————————————-
$terugvoer = array();
// — Retrieve the present list of versions ———————————–
$sql = “SELECT DISTINCT _TAK FROM questionnaire WHERE _TEMPLATE = ‘$questionnaire’ AND _VERSION = ‘$version’ “;
$db = new MysqliDb(‘CES’);
$selectStatus = $db->rawQuery($sql);
if ($selectStatus > 0) {
foreach ($selectStatus as $row) {
$terugvoer[] = $row[‘_TAK’];
}
}
echo json_encode($terugvoer);
?>
Javascript – Validating text input
</td><td><textarea rows=”2″ name=_CANCOMMENT’ + item.quest_id + ‘ id=_CANCOMMENT’ + item.quest_id + ‘ onkeyup = “Validate(this)” ‘ + ‘ onblur = “updateDetail(‘ + item.quest_id + ‘,’ + item._ACTUALPOINTS + ‘)” ‘ + ‘” class=”input-field control form-control” style=”width:400px”>’ + item._CANCOMMENT + ‘</textarea> </td>’
function Validate(txt) {
txt.value = txt.value.replace(/[^a-zA-Z 0-9\n\r]+/g, ”);
}
Textarea – Input
<td><textarea rows=”2″ name=_CANCOMMENT’ + item.quest_id + ‘ id=_CANCOMMENT’ + item.quest_id + ‘ onkeyup = “Validate(this)” ‘ + ‘ onblur = “updateDetail(‘ + item.quest_id + ‘,’ + item._ACTUALPOINTS + ‘)” ‘ + ‘” class=”input-field control form-control” style=”width:400px”>’ + item._CANCOMMENT + ‘</textarea> </td>’
function updateDetail (isn, outof) {
var cancommenttextarea = “_CANCOMMENT” + isn;
var cancomment = $(‘textarea[name=’ + cancommenttextarea + ‘]’).val();
Javascript – debugging
alert (“Javascript object – response : ” + JSON.stringify(response, null, 4));
PHP – Debugging
echo ‘<pre>’;
print_r($terugvoer);
echo ‘</pre>’;
Zebra_form – date control

$form->add(‘label’, ‘label_weekend’, ‘_WEEK_EINDE’, ‘lblWeekgeeindig’);
$obj = $form->add(‘date’, ‘_WEEK_EINDE’);
$obj->format(‘Ymd’);
$obj->set_rule(array(
‘date’ => array(‘error’, $translation->getValue(‘errDate’)),
‘required’ => array(‘error’, $translation->getValue(‘errRequired’)),
));
You must be logged in to post a comment.