This repository has been archived by the owner on Dec 2, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
AIIXForm Control Arrays
ailixter edited this page Mar 5, 2016
·
10 revisions
// scalar
echo \AIIX\Form::control('option1');
echo \AIIX\Form::label('option1');
<input id="option1" name="option1" type="checkbox"/>
<label for="option1">option1</label>
// array
$object_id = 123;
echo \AIIX\Form::control(array('option1', $object_id));
echo \AIIX\Form::label(array('option1', $object_id));
<input id="option1_123" name="option1[123]" type="checkbox"/>
<label for="option1_123">option1</label>
[option1]
-control = checkbox
$val1 = \AIIX\Form::filtered('option1');
echo \AIIX\Form::control('option1');
echo \AIIX\Form::label('option1');
$val1: 'on';
<input id="option1" name="option1" checked="checked" type="checkbox"/>
<label for="option1">option1</label>
[option2.0]
-control = checkbox
$object_id = 123;
$val2_0 = \AIIX\Form::filtered('option2.0');
echo \AIIX\Form::control(array('option2.0', $object_id));
echo \AIIX\Form::label(array('option2.0', $object_id));
$val2_0: false; // ERROR
<input id="option2.0_123" name="option2.0[123]" type="checkbox"/>
<label for="option2.0_123">option2.0</label>
[option2.1]
-control = checkbox
-filter[FILTER_DEFAULT] = FILTER_REQUIRE_ARRAY ; notice this
$val2_1 = \AIIX\Form::filtered('option2.1');
echo \AIIX\Form::control(array('option2.1', $object_id));
echo \AIIX\Form::label(array('option2.1', $object_id));
$val2_1: array (
123 => 'on', // CORRECT
);
<input id="option2.1_123" name="option2.1[123]" type="checkbox"/>
<label for="option2.1_123">option2.1</label>
TODO