Posted in PHP, zebra_form

Multiple dynamically filled zebra_form select boxes

$form->add(‘label’, ‘label_questionlist’, ”, “CESChooseaquestionfromthepool”);

for ($x = 0; $x <= 14; $x++) {

$obj = $form->add(‘select’, ‘_QUESTION_LIST’ . $x);

$obj->add_options($questionArray);

$obj->set_attributes(array(
‘class’ => ‘input-field control form-control’,
‘style’ => ‘width:500px’,
));

$obj->set_rule(array(

));

$obj->disable_spam_filter();

}

Posted in PHP, zebra_form

Multiple predefined zebra_form select boxes

$form->add(‘label’, ‘label_weight’, ”, “CESWeightin”);

for ($x = 0; $x <= 14; $x++) {

$obj = $form->add(‘select’, ‘_WEIGHT’ . $x);

$obj->add_options(array(
0 => ‘0’,
1 => ‘1’,
5 => ‘5’,
10 => ’10’,
15 => ’15’,
20 => ’20’,
25 => ’25’,
30 => ’30’,
35 => ’35’,
40 => ’40’,
45 => ’45’,
50 => ’50’,
60 => ’60’,
100 => ‘100’,
));

$obj->set_attributes(array(
‘class’ => ‘input-field control form-control’,
‘style’ => ‘width:150px’,
‘onChange’ => ‘calculatePercentage()’
));

$obj->set_rule(array(

));

$obj->disable_spam_filter();

}

Posted in HTML, zebra_form

Zebra_form radio buttons

$form->add(‘label’, ‘labelchart’, ‘_CHART’, $translation->getValue(“CESChart”));

$obj = $form->add(‘radios’, ‘_CHART’,
array(
‘N’ => ‘None’,
‘B’ => ‘Bar’,
‘R’ => ‘Radar’
),

‘N’

);

$obj->set_attributes(array(
‘onclick’ => ‘clearCharts()’
));

$obj->set_rule(array(

));

Template entry

RadiobuttonTemplate

Posted in JQuery, zebra_form

A zebra_form check box

YesNoCheckBox

// — _YN ———————————————————————

$form->add(‘label’, ‘label_yn’, ‘_YN’, ‘CESYesorNoonly’);

$obj = $form->add(‘checkbox’, ‘_YN’, ‘Y’);

$obj->set_attributes(array(
‘onclick’ => ‘evalAttributes()’
));

User defined Javascript function

function evalAttributes () {

if ($(‘#_YN_Y’).prop(‘checked’)){

}

}

Template entry

YN_Template
Posted in zebra_form

A zebra_form text field

<?php

require “”.$_SERVER[‘DOCUMENT_ROOT’].”/xyz/Zebra_Form/Zebra_Form.php”;

$form = new Zebra_Form(‘form1’, ‘post’, ”, array(‘autocomplete’ => ‘off’));

// — _QUESTION —————————————————————

$form->add(‘label’, ‘label_question’, ‘_QUESTION’, ‘CESNewQuestion’);

$obj = $form->add(‘text’, ‘_QUESTION’);

$obj->set_rule(array(
‘required’ => array(‘error’, ‘Required’),
‘length’ => array(0,150,’error’, (“Only 150 characters allowed”)),
‘alphanumeric’ => array(“#.,/+- “, ‘error’, ‘Invalid characters’)
));

$obj->set_attributes(array(
‘class’ => ‘input-field control form-control’,
‘style’ => ‘width:900px’
));

Template entry

QuestionTemplate