Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

User:Frank Ralf/Semantic HTML5: Difference between revisions

From MoodleDocs
Line 35: Line 35:
     <div class="fitem">
     <div class="fitem">
       <div class="fitemtitle">
       <div class="fitemtitle">
         <label for="id_81c61d">Mr. Smith </label>
         <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="id_miller">Math</label>
           <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>

</fieldset>