<?php
$mform = MForm::factory()
->addTextField("1.0")
->setAttribute('label', 'Text Label')
->setAttribute('class', 'mynewclass')
->setAttribute('style', 'width: 260px')
->setAttribute('default-value', 'default value string');
$mform->addTextField(1.2)
->setAttributes([
'label'=>'Text Label',
'class'=>'mynewclass',
'style'=>'width: 220px',
'default-value'=>'default value string'
]);
$mform->addTextField(1.3, [
'label'=>'Text Label',
'class'=>'mynewclass',
'style'=>'width: 280px',
'default-value'=>'default value string'
]);
$mform->addTextField(1.4)
->setLabel('Text Label')
->setAttribute('class', 'mynewclass')
->setAttribute('style', 'width: 220px')
->setDefaultValue('default value string');
$mform2 = MForm::factory()
->addSelectField("2.0", [1 => 'option 1', 2 => 'option 2'], [
'label'=>'Select Label',
'class'=>'mynewclass',
'style'=>'width: 260px',
'default-value'=>2
]);
$mform->addSelectField(2.1, [1 => 'option 1', 2 => 'option 2'])
->setAttributes([
'label'=>'Select Label',
'class'=>'mynewclass',
'style'=>'width: 220px',
'default-value'=>2
]);
$mform->addSelectField(2.2)
->setOptions([1 => 'option 1', 2 => 'option 2', 3 => 'option 3', 4 => 'option 4'])
->setOption('option 5', 5)
->setLabel('Select Label')
->setAttribute('class', 'mynewclass')
->setAttribute('style', 'width: 260px')
->setDefaultValue(2)
->setMultiple()
->setSize('full');
echo MForm::factory()
->addFieldsetArea('Fieldset Element', $mform)
->addFieldsetArea('Select elements with attributes', $mform2)
->show();