|
form not submitting correctly
hi,
Im not sure if im in the right forum......
Im developing a simple new module for the Moodle learning environment and i'm stuck. What exists now is a form with a text area. when submit is pressed, the contents of this area show up on the new page.
however i need three more text areas. I added a new one but the new page just shows two text areas holding the content from only the first text area). Could anyone spare a few minutes to have a look at my code to see where ive gone wrong??
I have a feeling i need to create a second print_textarea function.However, i think that all the modules in Moodle call on this function so If i changed it it might mess everything up.
Thanks in advance
kiwicas
PHP Code:
<?php
require("$CFG->dirroot/mod/nsolution/lib.php"); // for parameter arrays
// ...and fill the form if needed
if (empty($form->name))
{
$form->name = "";
}
if (empty($form->introduction)) {
$form->introduction = "";
}
if (empty($form->process)) {
$form->process = "";
}
if (!isset($form->gradingstrategy)) {
$form->gradingstrategy = 1;
}
if (empty($form->usemaximum)) {
$form->usemaximum = 0;
}
if (!isset($form->assessmentcomps)) {
$form->assessmentcomps = 2;
}
if (!isset($form->grade)) {
$form->grade = 100;
}
if (!isset($form->gradinggrade)) {
$form->gradinggrade = 100;
}
if (!isset($form->nelements)) {
$form->nelements = 2;
}
if (empty($form->maxbytes)) {
$form->maxbytes = "";
}
if (empty($form->deadline)) {
$form->deadline = "";
}
if (!isset($form->usepassword)) {
$form->usepassword = 0;
}
if (empty($form->showleaguetable)) {
$form->showleaguetable = "";
}
if (empty($form->anonymous)) {
$form->anonymous = 0;
}
$nohtmleditorneeded = true;
?>
<form name="form" method="post" action="mod.php">
<table cellpadding="5">
<tr valign="top">
<td align=right><p><b><?php print_string("nsolutionname", "nsolution") ?>:</b></p></td>
<td>
<input type="text" name="name" size=60 value="<?php p($form->name) ?>">
</td>
</tr>
<tr valign="top">
<td align=right><p><b><?php print_string("introduction", "nsolution") ?>:</b></p>
<font size="1">
<?php
helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
echo "<br />";
helpbutton("questions", get_string("helpquestions"), "moodle", true, true);
echo "<br />";
if ($usehtmleditor) {
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
} else {
emoticonhelpbutton("form", "introduction");
}
?>
<br />
</font>
</td>
<td>
<?php
print_textarea($usehtmleditor, 20, 60, 680, 400, "introduction", $form->introduction);
if ($usehtmleditor) {
echo '<input type="hidden" name="format" value="'.FORMAT_HTML.'" />';
} else {
echo '<p align="right">';
helpbutton("textformat", get_string("formattexttype"));
print_string("formattexttype");
echo ': ';
if (!$form->format) {
$form->format = $defaultformat;
}
choose_from_menu(format_text_menu(), "format", $form->format, "");
echo '</p>';
}
?>
</td>
</tr>
<tr valign="top">
<td align=right><p><b><?php print_string("process", "nsolution") ?>:</b></p>
<font size="1">
<?php
helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
echo "<br />";
helpbutton("questions", get_string("helpquestions"), "moodle", true, true);
echo "<br />";
if ($usehtmleditor) {
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
} else {
emoticonhelpbutton("form", "introduction");
}
?>
<br />
</font>
</td>
<td>
<?php
print_textarea($usehtmleditor, 20, 60, 680, 400, "process", $form->process);
if ($usehtmleditor) {
echo '<input type="hidden" name="format" value="'.FORMAT_HTML.'" />';
} else {
echo '<p align="right">';
helpbutton("textformat", get_string("formattexttype"));
print_string("formattexttype");
echo ': ';
if (!$form->format) {
$form->format = $defaultformat;
}
choose_from_menu(format_text_menu(), "format", $form->format, "");
echo '</p>';
}
?>
</td>
</tr>
</table>
<br />
<center>
<input type="hidden" name=course value="<?php p($form->course) ?>" />
<input type="hidden" name=coursemodule value="<?php p($form->coursemodule) ?>" />
<input type="hidden" name=section value="<?php p($form->section) ?>" />
<input type="hidden" name=module value="<?php p($form->module) ?>" />
<input type="hidden" name=modulename value="<?php p($form->modulename) ?>" />
<input type="hidden" name=instance value="<?php p($form->instance) ?>" />
<input type="hidden" name=mode value="<?php p($form->mode) ?>" />
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<input type="submit" value="<?php print_string("savechanges") ?>" />
<input type="submit" name=cancel value="<?php print_string("cancel") ?>" />
</center>
</form>
Last edited by LuciWiz : 25-May-2006 at 06:42.
Reason: Please insert your PHP code between [php] & [/php] tags
|