Frank Ralf (talk | contribs) No edit summary |
Frank Ralf (talk | contribs) |
||
Line 13: | Line 13: | ||
We will use some helper styles to see what's going on under the hood of Moodle forms. See [[Stylish]] for some of them. | We will use some helper styles to see what's going on under the hood of Moodle forms. See [[Stylish]] for some of them. | ||
== The code == | |||
We recreate a form similar to the one in the above mentioned forum discussion. This is just a textarea field with a save button put inside a table, nothing fancy. | |||
<code php> | |||
$mform =& $this->_form; | |||
$table_html = '<table>' | |||
.'<tr><th>Select student</th><th>Comment entered</th><th>Comment</th></tr>' | |||
.'<tr><td>Student Alpha</td><td>Yes</td><td>'; | |||
$mform->addElement('html', $table_html); | |||
$mform->addElement('textarea'); | |||
$this->add_action_buttons(false); | |||
$mform->addElement('html', '</td></tr></table>'); | |||
</code> | |||
== Screenshots == | == Screenshots == | ||
[TODO] | [TODO] |
Revision as of 11:58, 20 July 2009
Read the whole story:
- Frank Ralf/Moodle forms1
- Frank Ralf/Moodle forms2 aka Frank Ralf/Semantic HTML5
- Moodle forms - A peek under the hood
Moodle forms - A peek under the hood
Inspired by this forum discussion ("Interface design input please") I dug a little deeper into the way Moodle creates and handles forms.
For the JavaScript part of that discussion see Frank Ralf/JavaScript1.
We will use some helper styles to see what's going on under the hood of Moodle forms. See Stylish for some of them.
The code
We recreate a form similar to the one in the above mentioned forum discussion. This is just a textarea field with a save button put inside a table, nothing fancy.
$mform =& $this->_form;
$table_html = '
'
.''
.'Select student Comment entered Comment Student Alpha Yes ';
$mform->addElement('html', $table_html);
$mform->addElement('textarea');
$this->add_action_buttons(false);
$mform->addElement('html', '
');
Screenshots
[TODO]