mirror of
https://github.com/webmin/webmin.git
synced 2026-07-06 02:20:29 +01:00
Move the JS that re-enables opt textbox fields to the end of the form, so that it has access to the correct state https://sourceforge.net/p/webadmin/bugs/4293/
This commit is contained in:
@@ -659,6 +659,14 @@ if ($buttons && @$buttons) {
|
||||
$rv .= "</tr></table>\n";
|
||||
}
|
||||
$rv .= "</form>\n";
|
||||
# When going back to a form, re-enable any text fields generated by
|
||||
# ui_opt_textbox that aren't in the default state.
|
||||
$rv .= "<script>\n";
|
||||
$rv .= "var opts = document.getElementsByClassName('ui_opt_textbox');\n";
|
||||
$rv .= "for(var i=0; i<opts.length; i++) {\n";
|
||||
$rv .= " opts[i].disabled = document.getElementsByName(opts[i].name+'_def')[0].checked;\n";
|
||||
$rv .= "}\n";
|
||||
$rv .= "</script>\n";
|
||||
return $rv;
|
||||
}
|
||||
|
||||
@@ -1230,7 +1238,6 @@ $rv .= "<input class='ui_opt_textbox' name=\""."e_escape($name)."\" ".
|
||||
($max ? " maxlength=$max" : "").
|
||||
" ".$tags.
|
||||
">\n";
|
||||
$rv .= "<script>if ($ui_formcount < document.forms.length) { document.forms[$ui_formcount].$name.disabled = document.forms[$ui_formcount].${name}_def[0].checked; }</script>\n";
|
||||
return $rv;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user