Frank Ralf (talk | contribs) |
Frank Ralf (talk | contribs) |
||
Line 35: | Line 35: | ||
<div class="fitem"> | <div class="fitem"> | ||
<div class="fitemtitle"> | <div class="fitemtitle"> | ||
<label for=" | <label for="id_SMITH">Mr. Smith </label> | ||
</div> | </div> | ||
<div class="felement fcheckbox"> | <div class="felement fcheckbox"> | ||
<span> | <span> | ||
<input class="pe_teacher" id="id_SMITH" name="TEACHER" value="1" type="checkbox"> | <input class="pe_teacher" id="id_SMITH" name="TEACHER" value="1" type="checkbox"> | ||
<label for=" | <label for="id_SMITH">History</label> | ||
</span> | </span> | ||
</div> | </div> |
Revision as of 20:00, 15 June 2009
formslib - checkboxes
Styling forms proves a bit difficult due to the way formslib.php renders the individual form items. Let's look a an example.
Example PHP
$mform->addElement('header', 'checkboxes', get_string('checkboxtest', 'block_simpleblock'));
$mform->addElement(
'checkbox',
'TEACHER',
'Mr. Smith',
'History',
array('class'=>'pe_teacher', 'id'=> 'SMITH')
);
$mform->addElement(
'checkbox',
'teachers',
'Ms. Miller',
'Math',
array('class'=>'pe_teacher', 'id'=> 'miller')
);
Output HTML
(Only first form item shown.)
<fieldset class="clearfix" id="checkboxes">
<legend class="ftoggler">Checkbox Test</legend>
<label for="id_SMITH">Mr. Smith </label>
<input class="pe_teacher" id="id_SMITH" name="TEACHER" value="1" type="checkbox">
<label for="id_SMITH">History</label>
</fieldset>