MDL-8062 Remove name attribute from <form> and related javascript code cleanup (tested with FF, IE, Konq and Opera)

This commit is contained in:
skodak 2007-01-06 19:22:58 +00:00
parent ee7f231d08
commit d2ce367fb9
38 changed files with 135 additions and 125 deletions

View File

@ -815,7 +815,7 @@ function displaydir ($wdir) {
"zip" => "$strcreateziparchive"
);
if (!empty($count)) {
choose_from_menu ($options, "action", "", "$strwithchosenfiles...", "javascript:document.dirform.submit()");
choose_from_menu ($options, "action", "", "$strwithchosenfiles...", "javascript:getElementById('dirform').submit()");
}
echo "</td></tr></table>";
echo "</form>";

View File

@ -714,7 +714,7 @@ function form_table($nextstage = WELCOME, $formaction = "install.php") {
if ($nextstage != DOWNLOADLANG) {
$needtoopenform = false;
?>
<form name="installform" method="post" action="<?php echo $formaction ?>">
<form id="installform" method="post" action="<?php echo $formaction ?>">
<input type="hidden" name="stage" value="<?php echo $nextstage ?>" />
<?php
@ -916,7 +916,7 @@ function form_table($nextstage = WELCOME, $formaction = "install.php") {
<?php
if ($needtoopenform) {
?>
<form name="installform" method="post" action="<?php echo $formaction ?>">
<form id="installform" method="post" action="<?php echo $formaction ?>">
<input type="hidden" name="stage" value="<?php echo $nextstage ?>" />
<?php
}
@ -1197,8 +1197,8 @@ function database_js() {
function toggledbinfo() {
//Calculate selected value
var showid = 'mysql';
if (document.installform.dbtype.value) {
showid = document.installform.dbtype.value;
if (getElementById('installform').dbtype.value) {
showid = getElementById('installform').dbtype.value;
}
if (document.getElementById) {
//Hide all the divs

View File

@ -331,7 +331,7 @@
html_header($course, $wdir, "form.name");
echo "<p>$strrenamefileto:";
echo "<table border=\"0\">\n<tr>\n<td>\n";
echo "<form action=\"coursefiles.php\" method=\"post\" name=\"form\">\n";
echo "<form action=\"coursefiles.php\" method=\"post\" id=\"form\">\n";
echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />\n";
echo " <input type=\"hidden\" name=\"action\" value=\"rename\" />\n";
@ -809,7 +809,7 @@ function displaydir ($wdir) {
"zip" => "$strcreateziparchive"
);
if (!empty($count)) {
choose_from_menu ($options, "action", "", "$strwithchosenfiles...", "javascript:document.dirform.submit()");
choose_from_menu ($options, "action", "", "$strwithchosenfiles...", "javascript:getElementById('dirform').submit()");
}
if (!empty($USER->fileop) and ($USER->fileop == "move") and ($USER->filesource <> $wdir)) {
echo "<form action=\"coursefiles.php\" method=\"get\">\n";

View File

@ -51,7 +51,7 @@ border-bottom: 1px solid black; letter-spacing: 2px;
</head>
<body>
<div class="title"><?php print_string("createanchor","editor");?></div>
<form name="fie">
<form id="fie">
<table border="0" cellpadding="2" cellspacing="0">
<tr>
<td><?php print_string("anchorname","editor");?>: <input id="f_anc" name="anc" type="text" size="30" /></td>

View File

@ -178,7 +178,7 @@ form { margin-bottom: 0px; margin-top: 0px; }
<div class="space"></div>
<div class="space"></div>
<div class="space"></div>
<form action="" method="get" name="first" id="first">
<form action="" method="get" id="first">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="15%" align="right"><?php print_string("imageurl","editor");?>:</td>
@ -281,13 +281,13 @@ form { margin-bottom: 0px; margin-top: 0px; }
<?php if(has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $id))) { ?>
<table border="0" cellpadding="2" cellspacing="0">
<tr><td><?php print_string("selection","editor");?>: </td>
<td><form name="idelete" id="idelete">
<td><form id="idelete">
<input name="btnDelete" type="submit" id="btnDelete" value="<?php print_string("delete","editor");?>" onclick="return submit_form('delete');" /></form></td>
<td><form name="imove" id="imove">
<td><form id="imove">
<input name="btnMove" type="submit" id="btnMove" value="<?php print_string("move","editor");?>" onclick="return submit_form('move');" /></td>
<td><form name="izip" id="izip">
<td><form id="izip">
<input name="btnZip" type="submit" id="btnZip" value="<?php print_string("zip","editor");?>" onclick="return submit_form('zip');" /></form></td>
<td><form name="irename" id="irename" method="post" action="../coursefiles.php" target="ibrowser">
<td><form id="irename" method="post" action="../coursefiles.php" target="ibrowser">
<input type="hidden" name="id" value="<?php print($course->id);?>" />
<input type="hidden" name="wdir" value="" />
<input type="hidden" name="file" value="" />
@ -315,7 +315,7 @@ form { margin-bottom: 0px; margin-top: 0px; }
<tr>
<td height="22"><?php
if(has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $id))) { ?>
<form name="cfolder" id="cfolder" action="../coursefiles.php" method="post" target="ibrowser">
<form id="cfolder" action="../coursefiles.php" method="post" target="ibrowser">
<input type="hidden" name="id" value="<?php print($course->id);?>" />
<input type="hidden" name="wdir" value="" />
<input type="hidden" name="action" value="mkdir" />
@ -324,7 +324,7 @@ form { margin-bottom: 0px; margin-top: 0px; }
<input name="btnCfolder" type="submit" id="btnCfolder" value="<?php print_string("createfolder","editor");?>" onclick="return checkvalue('foldername','cfolder');" />
</form>
<div class="space"></div>
<form action="../coursefiles.php?id=<?php print($course->id);?>" method="post" enctype="multipart/form-data" name="uploader" target="ibrowser" id="uploader">
<form action="../coursefiles.php?id=<?php print($course->id);?>" method="post" enctype="multipart/form-data" target="ibrowser" id="uploader">
<input type="hidden" name="MAX_FILE_SIZE" value="<?php print($upload_max_filesize);?>" />
<input type="hidden" name="id" VALUE="<?php print($course->id);?>" />
<input type="hidden" name="wdir" value="" />

View File

@ -102,13 +102,13 @@ form { margin-bottom: 1px; margin-top: 1px; }
<td>
<table border="0" cellpadding="2" cellspacing="0">
<tr><td><?php print_string("selection","editor");?>: </td>
<td><form name="idelete" id="idelete">
<td><form id="idelete">
<input name="btnDelete" type="submit" id="btnDelete" value="<?php print_string("delete","editor");?>" onclick="return submit_form('delete');" /></form></td>
<td><form name="imove" id="imove">
<td><form id="imove">
<input name="btnMove" type="submit" id="btnMove" value="<?php print_string("move","editor");?>" onclick="return submit_form('move');" /></form></td>
<td><form name="izip" id="izip">
<td><form id="izip">
<input name="btnZip" type="submit" id="btnZip" value="<?php print_string("zip","editor");?>" onclick="return submit_form('zip');" /></form></td>
<td><form name="irename" id="irename" method="post" action="../coursefiles.php" target="fbrowser">
<td><form id="irename" method="post" action="../coursefiles.php" target="fbrowser">
<input type="hidden" name="id" value="<?php print($course->id);?>" />
<input type="hidden" name="wdir" value="" />
<input type="hidden" name="file" value="" />
@ -127,7 +127,7 @@ form { margin-bottom: 1px; margin-top: 1px; }
<tr>
<td height="22"><?php
if(has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $id))) { ?>
<form name="cfolder" id="cfolder" action="../coursefiles.php" method="post" target="fbrowser">
<form id="cfolder" action="../coursefiles.php" method="post" target="fbrowser">
<input type="hidden" name="id" value="<?php print($course->id);?>" />
<input type="hidden" name="wdir" value="" />
<input type="hidden" name="action" value="mkdir" />
@ -135,7 +135,7 @@ form { margin-bottom: 1px; margin-top: 1px; }
<input name="name" type="text" id="foldername" size="35" />
<input name="btnCfolder" type="submit" id="btnCfolder" value="<?php print_string("createfolder","editor");?>" onclick="return checkvalue('foldername','cfolder');" />
</form>
<form action="../coursefiles.php?id=<?php print($course->id);?>" method="post" enctype="multipart/form-data" name="uploader" target="fbrowser" id="uploader">
<form action="../coursefiles.php?id=<?php print($course->id);?>" method="post" enctype="multipart/form-data" target="fbrowser" id="uploader">
<input type="hidden" name="MAX_FILE_SIZE" value="<?php print($upload_max_filesize);?>" />
<input type="hidden" name="id" VALUE="<?php print($course->id);?>" />
<input type="hidden" name="wdir" value="" />

View File

@ -9,8 +9,10 @@ function popupchecker(msg) {
}
}
/*
function popUpProperties(inobj) {
op = window.open();
/// Legacy function
var op = window.open();
op.document.open('text/plain');
for (objprop in inobj) {
op.document.write(objprop + ' => ' + inobj[objprop] + '\n');
@ -19,6 +21,7 @@ function popUpProperties(inobj) {
}
function fillmessagebox(text) {
/// Legacy function
document.form.message.value = text;
}
@ -26,27 +29,34 @@ function copyrichtext(textname) {
/// Legacy stub for old editor - to be removed soon
return true;
}
*/
function checkall() {
void(d=document);
void(el=d.getElementsByTagName('INPUT'));
for(i=0;i<el.length;i++)
void(el[i].checked=1)
var el = document.getElementsByTagName('input');
for(var i=0; i<el.length; i++) {
if(el[i].type == 'checkbox') {
el[i].checked = true;
}
}
}
function checknone() {
void(d=document);
void(el=d.getElementsByTagName('INPUT'));
for(i=0;i<el.length;i++)
void(el[i].checked=0)
var el = document.getElementsByTagName('input');
for(var i=0; i<el.length; i++) {
if(el[i].type == 'checkbox') {
el[i].checked = false;
}
}
}
function lockoptions(form, master, subitems) {
function lockoptions(formid, master, subitems) {
// Subitems is an array of names of sub items.
// Optionally, each item in subitems may have a
// companion hidden item in the form with the
// same name but prefixed by "h".
if (eval("document."+form+"."+master+".checked")) {
var form = document.forms[formid];
if (eval("form."+master+".checked")) {
for (i=0; i<subitems.length; i++) {
unlockoption(form, subitems[i]);
}
@ -59,16 +69,16 @@ function lockoptions(form, master, subitems) {
}
function lockoption(form,item) {
eval("document."+form+"."+item+".disabled=true");/* IE thing */
if(document.forms[form].elements['h'+item]) {
eval("document."+form+".h"+item+".value=1");
eval("form."+item+".disabled=true");/* IE thing */
if(form.elements['h'+item]) {
eval("form.h"+item+".value=1");
}
}
function unlockoption(form,item) {
eval("document."+form+"."+item+".disabled=false");/* IE thing */
if(document.forms[form].elements['h'+item]) {
eval("document."+form+".h"+item+".value=0");
eval("form."+item+".disabled=false");/* IE thing */
if(form.elements['h'+item]) {
eval("form.h"+item+".value=0");
}
}
function lockoptionsall(formid) {
@ -139,7 +149,7 @@ function submitFormById(id) {
if(!theform) {
return false;
}
if(theform.tagName != 'FORM') {
if(theform.tagName != 'form') {
return false;
}
if(!theform.onsubmit || theform.onsubmit()) {
@ -148,7 +158,7 @@ function submitFormById(id) {
}
function select_all_in(elTagName, elClass, elId) {
var inputs = document.getElementsByTagName('INPUT');
var inputs = document.getElementsByTagName('input');
inputs = filterByParent(inputs, function(el) {return findParentNode(el, elTagName, elClass, elId);});
for(var i = 0; i < inputs.length; ++i) {
if(inputs[i].type == 'checkbox' || inputs[i].type == 'radio') {

View File

@ -858,15 +858,15 @@ class assignment_base {
echo '<script type="text/javascript">'."\n";
echo 'function setNext(){'."\n";
echo 'document.submitform.mode.value=\'next\';'."\n";
echo 'document.submitform.userid.value="'.$nextid.'";'."\n";
echo 'getElementById(\'submitform\').mode.value=\'next\';'."\n";
echo 'getElementById(\'submitform\').userid.value="'.$nextid.'";'."\n";
echo '}'."\n";
echo 'function saveNext(){'."\n";
echo 'document.submitform.mode.value=\'saveandnext\';'."\n";
echo 'document.submitform.userid.value="'.$nextid.'";'."\n";
echo 'document.submitform.saveuserid.value="'.$userid.'";'."\n";
echo 'document.submitform.menuindex.value = document.submitform.grade.selectedIndex;'."\n";
echo 'getElementById(\'submitform\').mode.value=\'saveandnext\';'."\n";
echo 'getElementById(\'submitform\').userid.value="'.$nextid.'";'."\n";
echo 'getElementById(\'submitform\').saveuserid.value="'.$userid.'";'."\n";
echo 'getElementById(\'submitform\').menuindex.value = getElementById(\'submitform\').grade.selectedIndex;'."\n";
echo '}'."\n";
echo '</script>'."\n";
@ -922,7 +922,7 @@ class assignment_base {
///Print Buttons in Single View
echo '<div class="buttons" align="center">';
echo '<input type="submit" name="submit" value="'.get_string('savechanges').'" onclick = "document.submitform.menuindex.value = document.submitform.grade.selectedIndex" />';
echo '<input type="submit" name="submit" value="'.get_string('savechanges').'" onclick = "getElementById(\'submitform\').menuindex.value = getElementById(\'submitform\').grade.selectedIndex" />';
echo '<input type="submit" name="cancel" value="'.get_string('cancel').'" />';
//if there are more to be graded.
if ($nextid) {

View File

@ -37,7 +37,7 @@
//]]>
</script>
<form name="form" method="post" action="../mod/assignment/details.php">
<form id="form" method="post" action="../mod/assignment/details.php">
<table cellpadding="5">
<tr valign="top">
<td align="right"><b><?php print_string("assignmentname", "assignment") ?>:</b></td>

View File

@ -85,7 +85,7 @@
}
print_heading(get_string("amend", "exercise")." ".get_string("gradeforstudentsassessment",
"exercise", $course->student));
echo "<form name=\"amendgrade\" method=\"post\" action=\"assessments.php\">\n";
echo "<form id=\"amendgrade\" method=\"post\" action=\"assessments.php\">\n";
echo "<input type=\"hidden\" name=\"aid\" value=\"$aid\" />\n";
echo "<input type=\"hidden\" name=\"action\" value=\"updategradinggrade\" />\n";
echo "<input type=\"hidden\" name=\"id\" value=\"$cm->id\" />\n";
@ -271,7 +271,7 @@
// set up heading, form and table
print_heading_with_help(get_string("editingassessmentelements", "exercise"), "elements", "exercise");
?>
<form name="form" method="post" action="assessments.php">
<form id="form" method="post" action="assessments.php">
<input type="hidden" name="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="action" value="insertelements" />
<center><table cellpadding="5" border="1">

View File

@ -1567,7 +1567,7 @@ function exercise_print_assessment_form($exercise, $assessment = false, $allowch
// now print the grading form with the teacher's comments if any
// FORM is needed for Mozilla browsers, else radio bttons are not checked
?>
<form name="assessmentform" method="post" action="assessments.php">
<form id="assessmentform" method="post" action="assessments.php">
<input type="hidden" name="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="aid" value="<?php echo $assessment->id ?>" />
<input type="hidden" name="action" value="updateassessment" />
@ -2017,9 +2017,9 @@ function exercise_print_assessment_form($exercise, $assessment = false, $allowch
if (isteacher($course->id)) {
// ...show two buttons...to resubmit or not to resubmit
echo "<input type=\"button\" value=\"".get_string("studentnotallowed", "exercise", $course->student)."\"
onclick=\"document.assessmentform.submit();\" />\n";
onclick=\"getElementById('assessmentform').submit();\" />\n";
echo "<input type=\"button\" value=\"".get_string("studentallowedtoresubmit", "exercise", $course->student)."\"
onclick=\"document.assessmentform.resubmit.value='1';document.assessmentform.submit();\" />\n";
onclick=\"getElementById('assessmentform').resubmit.value='1';getElementById('assessmentform').submit();\" />\n";
}
else {
// ... show save button
@ -2368,7 +2368,7 @@ function exercise_print_teacher_assessment_form($exercise, $assessment, $submiss
echo "</td></tr></table></center><br clear=\"all\" />\n";
?>
<form name="assessmentform" method="post" action="assessments.php">
<form id="assessmentform" method="post" action="assessments.php">
<input type="hidden" name="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="said" value="<?php echo $assessment->id ?>" />
<input type="hidden" name="sid" value="<?php echo $submission->id ?>" />
@ -2784,9 +2784,9 @@ function exercise_print_teacher_assessment_form($exercise, $assessment, $submiss
// ...and close the table and show two buttons...to resubmit or not to resubmit
echo "</table>\n";
echo "<br /><input type=\"button\" value=\"".get_string("studentnotallowed", "exercise", $course->student)."\"
onclick=\"document.assessmentform.submit();\" />\n";
onclick=\"getElementById('assessmentform').submit();\" />\n";
echo "<input type=\"button\" value=\"".get_string("studentallowedtoresubmit", "exercise", $course->student)."\"
onclick=\"document.assessmentform.resubmit.value='1';document.assessmentform.submit();\" />\n";
onclick=\"getElementById('assessmentform').resubmit.value='1';getElementById('assessmentform').submit();\" />\n";
echo "</center></form>\n";
}

View File

@ -69,7 +69,7 @@
$submission = get_record("exercise_submissions", "id", $sid);
print_heading(get_string("amendtitle", "exercise"));
?>
<form name="amendtitleform" action="submissions.php" method="post">
<form id="amendtitleform" action="submissions.php" method="post">
<input type="hidden" name="action" value="adminupdatetitle" />
<input type="hidden" name="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="sid" value="<?php echo $sid ?>" />

View File

@ -251,7 +251,7 @@
if (!$correctpass) {
print_simple_box_start("center");
echo "<form name=\"password\" method=\"post\" action=\"view.php\">\n";
echo "<form id=\"password\" method=\"post\" action=\"view.php\">\n";
echo "<input type=\"hidden\" name=\"id\" value=\"$cm->id\" />\n";
echo "<table cellpadding=\"7px\">";
if (isset($_POST['userpassword'])) {

View File

@ -275,7 +275,7 @@ function forum_print_big_search_form($course) {
echo "var timetoitems = ['today','tomonth','toyear','tohour','tominute'];\n";
echo "</script>\n";
echo '<form name="search" action="search.php" method="get">';
echo '<form id="searchform" action="search.php" method="get">';
echo '<input type="hidden" value="'.$course->id.'" name="id" alt="" />';
echo '<table cellpadding="10" class="searchbox" id="form">';
@ -304,7 +304,7 @@ function forum_print_big_search_form($course) {
echo '<tr>';
echo '<td class="c0">'.get_string('searchdatefrom', 'forum').':</td>';
echo '<td class="c1">';
echo '<input name="timefromrestrict" type="checkbox" value="1" alt="'.get_string('searchdatefrom', 'forum').'" onclick="return lockoptions(\'search\', \'timefromrestrict\', timefromitems)" /> ';
echo '<input name="timefromrestrict" type="checkbox" value="1" alt="'.get_string('searchdatefrom', 'forum').'" onclick="return lockoptions(\'searchform\', \'timefromrestrict\', timefromitems)" /> ';
if (empty($dateto)) {
$datefrom = make_timestamp(2000, 1, 1, 0, 0, 0);
}
@ -323,7 +323,7 @@ function forum_print_big_search_form($course) {
echo '<tr>';
echo '<td class="c0">'.get_string('searchdateto', 'forum').':</td>';
echo '<td class="c1">';
echo '<input name="timetorestrict" type="checkbox" value="1" alt="'.get_string('searchdateto', 'forum').'" onclick="return lockoptions(\'search\', \'timetorestrict\', timetoitems)" /> ';
echo '<input name="timetorestrict" type="checkbox" value="1" alt="'.get_string('searchdateto', 'forum').'" onclick="return lockoptions(\'searchform\', \'timetorestrict\', timetoitems)" /> ';
if (empty($dateto)) {
$dateto = time()+3600;
}
@ -365,8 +365,8 @@ function forum_print_big_search_form($course) {
echo '</form>';
echo "<script type=\"text/javascript\">";
echo "lockoptions('search','timefromrestrict', timefromitems);";
echo "lockoptions('search','timetorestrict', timetoitems);";
echo "lockoptions('searchform','timefromrestrict', timefromitems);";
echo "lockoptions('searchform','timetorestrict', timetoitems);";
echo "</script>\n";
print_simple_box_end();

View File

@ -60,7 +60,7 @@ $text_source_options = array(
//]]>
</script>
<center>
<form name="form" method="post" action="mod.php">
<form id="form" method="post" action="mod.php">
<table cellpadding="5">
<tr valign="top">
<td align="right"><b><?php print_string("name") ?>:</b></td>
@ -371,7 +371,7 @@ $text_source_options = array(
// override the standard Moodle "setfocus" function,
// which gives a js error if the "name" field is hidden
function setfocus() {
var f = document.form;
var f = getElementById('form');
if (f) {
if (canfocus(f, 'namesource')) {
f.namesource.focus();

View File

@ -33,7 +33,7 @@ if (!isset($form->create_sequence_url)) {
}
?>
<form name="form" method="post" action="mod.php" onSubmit="disableSumbit(this);">
<form id="form" method="post" action="mod.php" onSubmit="disableSumbit(this);">
<center>
<span id="message"><p>Please wait .......</p></span>
<table cellpadding="5">
@ -229,7 +229,7 @@ function refreshLists(){
dol = new DynamicOptionList("workspace","sequence");
dol.setFormName("form");
url = "../mod/lams/list.php?courseid="+document.form.course.value;
url = "../mod/lams/list.php?courseid="+getElementById('form').course.value;
if (window.XMLHttpRequest) { // Non-IE browsers
req = new XMLHttpRequest();
req.onreadystatechange = processStateChange;

View File

@ -72,7 +72,7 @@
<?php } ?>
<form name="pageform" method ="post" action="<?php echo $CFG->wwwroot ?>/mod/lesson/view.php">
<form id="pageform" method ="post" action="<?php echo $CFG->wwwroot ?>/mod/lesson/view.php">
<input type="hidden" name="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="pageid" value="<?php echo $newpageid ?>" />

View File

@ -944,7 +944,7 @@
if (!$highscores or $madeit) {
echo '<p>'.get_string("youmadehighscore", "lesson", $lesson->maxhighscores).
'</p><p>
<form method="post" name="highscores" action="'.$CFG->wwwroot.'/mod/lesson/highscores.php">
<form method="post" id="highscores" action="'.$CFG->wwwroot.'/mod/lesson/highscores.php">
<input type="hidden" name="mode" value="add" />
<input type="hidden" name="id" value="'.$cm->id.'" />
<input type="hidden" name="sesskey" value="'.sesskey().'" />

View File

@ -87,7 +87,7 @@
//]]>
</script>
<form method="post" action="module.php" name="form">
<form method="post" action="module.php" id="form">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<!-- Table of default values -->

View File

@ -1,4 +1,4 @@
<form method="post" action="module.php" name="form">
<form method="post" action="module.php" id="form">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
<table cellpadding="9" cellspacing="0" >

View File

@ -1,4 +1,4 @@
<form name="form" method="post" action="<?php echo "$CFG->wwwroot/course/mod.php" ?>">
<form id="form" method="post" action="<?php echo "$CFG->wwwroot/course/mod.php" ?>">
<input type="hidden" name="type" value="<?php p($form->type) ?>" />
<input type="hidden" name="course" value="<?php p($form->course) ?>" />

View File

@ -36,10 +36,10 @@
<br />
<div align="center" class="form">
<form name="myform">
<form id="myform">
<input type="file" size="60" name="myfile"><br />
<input type="button" value="<?php print_string('localfileselect','resource') ?>"
onClick="return set_value(document.myform.myfile.value)">
onClick="return set_value(getElementById('myform').myfile.value)">
<input type="button" value="<?php print_string('cancel') ?>"
onClick="window.close()">
</form>

View File

@ -32,20 +32,20 @@
} else if (txt.indexOf('\\') > -1) {
txt = txt.substring(0,txt.lastIndexOf('\\'));
}
document.myform.pathname.value = txt;
document.myform.submit();
getElementById('myform').pathname.value = txt;
getElementById('myform').submit();
}
//]]>
</script>
<br />
<div align="center" class="form">
<form name="myform" action="localpath.php" method="post">
<form id="myform" action="localpath.php" method="post">
<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>">
<input type="hidden" name="pathname" value="">
<input type="file" size="60" name="myfile"><br />
<input type="button" value="<?php print_string('localfileselect','resource') ?>"
onClick="return set_value(document.myform.myfile.value)">
onClick="return set_value(getElementById('myform').myfile.value)">
<input type="button" value="<?php print_string('cancel') ?>"
onClick="window.close()">
</form>

View File

@ -40,7 +40,7 @@ $query .= '&HIVE_SESSION='.$SESSION->HIVE_SESSION;
/***********8
notify('Opening HarvestRoad Hive. Please wait. Contacting '. $CFG->hivehost );
echo '<form name="OPEN_HIVE_FORM" action="'. $CFG->hiveprotocol .'://'. $CFG->hivehost .':'. $CFG->hiveport .''. $CFG->hivepath .'" method="post">';
echo '<form id="OPEN_HIVE_FORM" action="'. $CFG->hiveprotocol .'://'. $CFG->hivehost .':'. $CFG->hiveport .''. $CFG->hivepath .'" method="post">';
echo '<input type="hidden" name="HISTORY" value="">';
echo '<input type="hidden" name="hiveLanguage" value="en_AU">';
@ -62,7 +62,7 @@ $query .= '&HIVE_SESSION='.$SESSION->HIVE_SESSION;
echo '</form>';
echo '<script type="text/javascript"/>';
echo "\n//<![CDATA[\n";
echo 'document.OPEN_HIVE_FORM.submit();';
echo 'getElementById(\'OPEN_HIVE_FORM\').submit();';
echo "\n//]]>\n";
echo '</script>';

View File

@ -205,7 +205,7 @@
}
</script>
<form name="form" method="post" action="mod.php?goto=" onsubmit="return validate_scorm(document.form,document.form.reference.value,false)">
<form id="form" method="post" action="mod.php?goto=" onsubmit="return validate_scorm(getElementById('form'),getElementById('form').reference.value,false)">
<table cellpadding="5">
<tr valign="top">
<td align="right"><b><?php print_string('name') ?>:</b></td>
@ -243,7 +243,7 @@
<td align="right"><b><?php print_string('grademethod', 'scorm') ?>:</b></td>
<td>
<?php
choose_from_menu($SCORM_GRADE_METHOD, 'grademethod', (int) $form->grademethod, '','checkscormform(this,0,document.form.maxgrade);');
choose_from_menu($SCORM_GRADE_METHOD, 'grademethod', (int) $form->grademethod, '','checkscormform(this,0,getElementById(\'form\').maxgrade);');
helpbutton('grademethod', get_string('grademethod','scorm'), 'scorm');
?>
</td>
@ -272,7 +272,7 @@
$attempts[$i] = $i . ' ' . get_string('attempts','scorm');
}
}
choose_from_menu($attempts, 'maxattempt', (int) $form->maxattempt, get_string('nolimit','scorm'),'checkscormform(this,1,document.form.whatgrade);');
choose_from_menu($attempts, 'maxattempt', (int) $form->maxattempt, get_string('nolimit','scorm'),'checkscormform(this,1,getElementById(\'form\').whatgrade);');
helpbutton('maxattempt', get_string('maximumattempts','scorm'), 'scorm');
?>
</td>

View File

@ -163,7 +163,7 @@ function checkform() {
var error=false;
with (document.form) {
with (getElementById('form')) {
<?php
if (!empty($checklist)) {
foreach ($checklist as $question => $default) {
@ -176,7 +176,7 @@ function checkform() {
if (error) {
alert("<?php print_string("questionsnotanswered", "survey") ?>");
} else {
document.form.submit();
getElementById('form').submit();
}
}

View File

@ -418,7 +418,7 @@
error("Edit Comment: Submission not found");
}
?>
<form name="gradingform" action="assessments.php" method="post">
<form id="gradingform" action="assessments.php" method="post">
<input type="hidden" name="action" value="updatecomment" />
<input type="hidden" name="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="cid" value="<?php echo $cid ?>" />
@ -454,7 +454,7 @@
// set up heading, form and table
print_heading_with_help(get_string("editingassessmentelements", "workshop"), "elements", "workshop");
?>
<form name="form" method="post" action="assessments.php">
<form id="form" method="post" action="assessments.php">
<input type="hidden" name="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="action" value="insertelements" />
<center><table cellpadding="5" border="1">

View File

@ -2138,17 +2138,17 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
if ($allowchanges and workshop_is_teacher($workshop, $USER->id)) {
echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"".
get_string("addcomment", "workshop")."\"
onclick=\"document.assessmentform.action.value='addstockcomment';
document.assessmentform.elementno.value=$i;document.assessmentform.submit();\" /> \n";
onclick=\"getElementById('assessmentform').action.value='addstockcomment';
getElementById('assessmentform').elementno.value=$i;getElementById('assessmentform').submit();\" /> \n";
helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop");
echo "</td><td>\n";
if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id
AND elementno = $i", "id")) { // show comments in fixed order (oldest first)
foreach ($stockcomments as $stockcomment) {
echo "<a onclick=\"document.assessmentform.feedback_$i.value+=' '+'".
echo "<a onclick=\"getElementById('assessmentform').feedback_$i.value+=' '+'".
addslashes($stockcomment->comments)."';\">&lt;&lt;$stockcomment->comments&gt;&gt;</a>\n";
if (workshop_is_teacheredit($workshop, $USER->id)) {
echo " <a onclick=\"document.assessmentform.action.value='removestockcomment';document.assessmentform.stockcommentid.value=$stockcomment->id;document.assessmentform.submit();\"> <small><i>&lt;--".get_string("delete","workshop")."</i></small></a>\n";
echo " <a onclick=\"getElementById('assessmentform').action.value='removestockcomment';getElementById('assessmentform').stockcommentid.value=$stockcomment->id;getElementById('assessmentform').submit();\"> <small><i>&lt;--".get_string("delete","workshop")."</i></small></a>\n";
}
echo "<br />\n";
}
@ -2242,18 +2242,18 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
if ($allowchanges and workshop_is_teacher($workshop, $USER->id)) {
echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"".
get_string("addcomment", "workshop")."\"
onclick=\"document.assessmentform.action.value='addstockcomment';
document.assessmentform.elementno.value=$i;document.assessmentform.submit();\" /> \n";
onclick=\"getElementById('assessmentform').action.value='addstockcomment';
getElementById('assessmentform').elementno.value=$i;getElementById('assessmentform').submit();\" /> \n";
helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop");
echo "</td><td>\n";
if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id
AND elementno = $i", "id")) { // get comments in a fixed order - oldest first
foreach ($stockcomments as $stockcomment) {
echo "<a onclick=\"document.assessmentform.feedback_$i.value+=' '+'".
echo "<a onclick=\"getElementById('assessmentform').feedback_$i.value+=' '+'".
addslashes($stockcomment->comments).
"';\">&lt;&lt;$stockcomment->comments&gt;&gt;</a>\n";
if (workshop_is_teacheredit($workshop, $USER->id)) {
echo " <a onclick=\"document.assessmentform.action.value='removestockcomment';document.assessmentform.stockcommentid.value=$stockcomment->id;document.assessmentform.submit();\"> <small><i>&lt;--".get_string("delete","workshop")."</i></small></a>\n";
echo " <a onclick=\"getElementById('assessmentform').action.value='removestockcomment';getElementById('assessmentform').stockcommentid.value=$stockcomment->id;getElementById('assessmentform').submit();\"> <small><i>&lt;--".get_string("delete","workshop")."</i></small></a>\n";
}
echo "<br />\n";
}
@ -2347,18 +2347,18 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
if ($allowchanges and workshop_is_teacher($workshop, $USER->id)) {
echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"".
get_string("addcomment", "workshop")."\"
onclick=\"document.assessmentform.action.value='addstockcomment';
document.assessmentform.elementno.value=$i;document.assessmentform.submit();\" /> \n";
onclick=\"getElementById('assessmentform').action.value='addstockcomment';
getElementById('assessmentform').elementno.value=$i;getElementById('assessmentform').submit();\" /> \n";
helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop");
echo "</td><td>\n";
if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id
AND elementno = $i", "id")) { // get comments in a fixed order - oldest first
foreach ($stockcomments as $stockcomment) {
echo "<a onclick=\"document.assessmentform.feedback_$i.value+=' '+'".
echo "<a onclick=\"getElementById('assessmentform').feedback_$i.value+=' '+'".
addslashes($stockcomment->comments).
"';\">&lt;&lt;$stockcomment->comments&gt;&gt;</a>\n";
if (workshop_is_teacheredit($workshop, $USER->id)) {
echo " <a onclick=\"document.assessmentform.action.value='removestockcomment';document.assessmentform.stockcommentid.value=$stockcomment->id;document.assessmentform.submit();\"> <small><i>&lt;--".get_string("delete","workshop")."</i></small></a>\n";
echo " <a onclick=\"getElementById('assessmentform').action.value='removestockcomment';getElementById('assessmentform').stockcommentid.value=$stockcomment->id;getElementById('assessmentform').submit();\"> <small><i>&lt;--".get_string("delete","workshop")."</i></small></a>\n";
}
echo "<br />\n";
}
@ -2510,18 +2510,18 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
if ($allowchanges and workshop_is_teacher($workshop, $USER->id)) {
echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"".
get_string("addcomment", "workshop")."\"
onclick=\"document.assessmentform.action.value='addstockcomment';
document.assessmentform.elementno.value=$i;document.assessmentform.submit();\" /> \n";
onclick=\"getElementById('assessmentform').action.value='addstockcomment';
getElementById('assessmentform').elementno.value=$i;getElementById('assessmentform').submit();\" /> \n";
helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop");
echo "</td><td>\n";
if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id
AND elementno = $i", "id")) { // show comments in fixed (creation) order
foreach ($stockcomments as $stockcomment) {
echo "<a onclick=\"document.assessmentform.feedback_$i.value+=' '+'".
echo "<a onclick=\"getElementById('assessmentform').feedback_$i.value+=' '+'".
addslashes($stockcomment->comments).
"';\">&lt;&lt;$stockcomment->comments&gt;&gt;</a>\n";
if (workshop_is_teacheredit($workshop, $USER->id)) {
echo " <a onclick=\"document.assessmentform.action.value='removestockcomment';document.assessmentform.stockcommentid.value=$stockcomment->id;document.assessmentform.submit();\"> <small><i>&lt;--".get_string("delete","workshop")."</i></small></a>\n";
echo " <a onclick=\"getElementById('assessmentform').action.value='removestockcomment';getElementById('assessmentform').stockcommentid.value=$stockcomment->id;getElementById('assessmentform').submit();\"> <small><i>&lt;--".get_string("delete","workshop")."</i></small></a>\n";
}
echo "<br />\n";
}
@ -2571,17 +2571,17 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
if ($allowchanges and workshop_is_teacher($workshop, $USER->id)) {
echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"".
get_string("addcomment", "workshop")."\"
onclick=\"document.assessmentform.action.value='addstockcomment';
document.assessmentform.elementno.value=99;document.assessmentform.submit();\" /> \n";
onclick=\"getElementById('assessmentform').action.value='addstockcomment';
getElementById('assessmentform').elementno.value=99;getElementById('assessmentform').submit();\" /> \n";
helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop");
echo "</td><td>\n";
if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id
AND elementno = 99", "id")) { // show in the same order (oldest at the top)
foreach ($stockcomments as $stockcomment) {
echo "<a onclick=\"document.assessmentform.generalcomment.value+=' '+'".
echo "<a onclick=\"getElementById('assessmentform').generalcomment.value+=' '+'".
addslashes($stockcomment->comments)."';\">&lt;&lt;$stockcomment->comments&gt;&gt;</a>\n";
if (workshop_is_teacheredit($workshop, $USER->id)) {
echo " <a onclick=\"document.assessmentform.action.value='removestockcomment';document.assessmentform.stockcommentid.value=$stockcomment->id;document.assessmentform.submit();\"> <small><i>&lt;--".get_string("delete","workshop")."</i></small></a>\n";
echo " <a onclick=\"getElementById('assessmentform').action.value='removestockcomment';getElementById('assessmentform').stockcommentid.value=$stockcomment->id;getElementById('assessmentform').submit();\"> <small><i>&lt;--".get_string("delete","workshop")."</i></small></a>\n";
}
echo "<br />\n";
}
@ -2630,9 +2630,9 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
if (($submission->userid == $USER->id) and !$assessment->timeagreed and !$comments and $showcommentlinks and
$submission->userid != $assessment->userid) {
echo "<input type=\"button\" value=\"".get_string("agreetothisassessment", "workshop")."\"
onclick=\"document.assessmentform.action.value='agreeassessment';document.assessmentform.submit();\" />\n";
onclick=\"getElementById('assessmentform').action.value='agreeassessment';getElementById('assessmentform').submit();\" />\n";
echo "<input type=\"submit\" value=\"".get_string("disagreewiththisassessment", "workshop")."\"
onclick=\"document.assessmentform.action.value='addcomment';document.assessmentform.submit();\" />\n";
onclick=\"getElementById('assessmentform').action.value='addcomment';getElementById('assessmentform').submit();\" />\n";
}
}
echo "</center>";

View File

@ -241,7 +241,7 @@
error(get_string('notallowed', 'workshop'));
}
?>
<form name="editform" enctype="multipart/form-data" action="submissions.php" method="post">
<form id="editform" enctype="multipart/form-data" action="submissions.php" method="post">
<input type="hidden" name="action" value="updatesubmission" />
<input type="hidden" name="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="sid" value="<?php echo $sid ?>" />
@ -260,8 +260,8 @@
if ($files = get_directory_list($basedir)) {
echo "<tr><td><b>".get_string("attachments", "workshop").
"</b><div align=\"right\"><input type=\"button\" value=\"".get_string("removeallattachments",
"workshop")."\" onclick=\"document.editform.action.value='removeattachments';
document.editform.submit();\"/></div></td></tr>\n";
"workshop")."\" onclick=\"getElementById('editform').action.value='removeattachments';
getElementById('editform').submit();\"/></div></td></tr>\n";
$n = 1;
foreach ($files as $file) {
$icon = mimeinfo("icon", $file);

View File

@ -169,7 +169,7 @@ function question_category_form($course, $current, $recurse=1, $showhidden=false
echo "<input type=\"submit\" value=\"$streditcats\" />";
echo "</form>";
echo '</td></tr></table>';
echo '<form method="post" action="edit.php" name="displayoptions">';
echo '<form method="post" action="edit.php" id="displayoptions">';
echo '<table><tr><td>';
echo "<input type=\"hidden\" name=\"courseid\" value=\"{$course->id}\" />";
echo '<input type="hidden" name="recurse" value="0" />';
@ -177,7 +177,7 @@ function question_category_form($course, $current, $recurse=1, $showhidden=false
if ($recurse) {
echo ' checked="checked"';
}
echo ' onchange="document.displayoptions.submit(); return true;" />';
echo ' onchange="getElementById(\'displayoptions\').submit(); return true;" />';
print_string('recurse', 'quiz');
// hide-feature
echo '<br />';
@ -186,7 +186,7 @@ function question_category_form($course, $current, $recurse=1, $showhidden=false
if ($showhidden) {
echo ' checked="checked"';
}
echo ' onchange="document.displayoptions.submit(); return true;" />';
echo ' onchange="getElementById(\'displayoptions\').submit(); return true;" />';
print_string('showhidden', 'quiz');
echo '</td><noscript><td valign="center">';
echo ' <input type="submit" value="'. get_string('go') .'" />';

View File

@ -225,7 +225,7 @@
?>
<form name="form" enctype="multipart/form-data" method="post" action="import.php">
<form id="form" enctype="multipart/form-data" method="post" action="import.php">
<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
<?php print_simple_box_start("center"); ?>
<table cellpadding="5">

View File

@ -89,7 +89,7 @@ $QTYPES[$question->qtype]->print_question_form_end($question,
function determineMinAndMax() {
// This client-side script will determine the values for min and max
// based on the input for answer and acceptederror.
with(document.theform) {
with(getElementById('theform')) {
if (formula0.value=='') {
alert('<?php print_string("missingformula","quiz") ?>');
return false;
@ -103,8 +103,8 @@ function determineMinAndMax() {
} else if (isNaN(tolerance0.value)) {
alert('<?php print_string("tolerancemustbenumeric","quiz") ?>');
return false;
} else if ('2' == document.theform['correctanswerformat[]'].value
&& '0' == document.theform['correctanswerlength[]'].value) {
} else if ('2' == getElementById('theform')['correctanswerformat[]'].value
&& '0' == getElementById('theform')['correctanswerlength[]'].value) {
alert('<?php print_string("zerosignificantfiguresnotallowed","quiz") ?>');
return false;
} else {

View File

@ -337,7 +337,7 @@ class question_calculated_qtype extends question_dataset_dependent_questiontype
: 'significantfigures'), 'quiz', $i);
}
return '<input type="submit" onClick="'
. "document.addform.regenerateddefid.value='$defid'; return true;"
. "getElementById('addform').regenerateddefid.value='$defid'; return true;"
.'" value="'. get_string('generatevalue', 'quiz') . '"/><br/>'
. '<input type="text" size="3" name="calcmin[]" '
. " value=\"$regs[2]\"/> &amp; <input name=\"calcmax[]\" "

View File

@ -249,7 +249,7 @@
// Print the new-dataset table
$addtable->data = array($addline);
echo "<form name=\"addform\" method=\"post\" action=\"question.php\">
echo "<form id=\"addform\" method=\"post\" action=\"question.php\">
<input type=\"hidden\" name=\"regenerateddefid\" value=\"0\"/>
<input type=\"hidden\" name=\"id\" value=\"$question->id\"/>
<input type=\"hidden\" name=\"category\" value=\"$question->category\"/>

View File

@ -1,4 +1,4 @@
<form name="theform" method="post" action="question.php">
<form id="theform" method="post" action="question.php">
<center>
<table cellpadding="5">
<?php if (!empty($datasets)) { ?>

View File

@ -1,4 +1,4 @@
<form name="theform" method="post" action="question.php">
<form id="theform" method="post" action="question.php">
<center>
<table cellpadding="5">

View File

@ -1,4 +1,4 @@
<form name="theform" method="post" action="question.php">
<form id="theform" method="post" action="question.php">
<center>
<table cellpadding="5">

View File

@ -1,4 +1,4 @@
<form name="theform" method="post" action="question.php">
<form id="theform" method="post" action="question.php">
<table cellpadding="5">
<tr valign="top">