Browse files

Update to static JS - 'hitem' hidden fields now optional for lockopti…

…ons.
  • Loading branch information...
1 parent 43a8cee commit 027d0485741f89b6ebce6be2b61ab3ce7c42cd8e sam_marshall committed Sep 20, 2006
Showing with 9 additions and 5 deletions.
  1. +9 −5 lib/javascript-static.js
View
14 lib/javascript-static.js
@@ -42,10 +42,10 @@ function checknone() {
}
function lockoptions(form, master, subitems) {
- // subitems is an array of names of sub items
- // requires that each item in subitems has a
+ // 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"
+ // same name but prefixed by "h".
if (eval("document."+form+"."+master+".checked")) {
for (i=0; i<subitems.length; i++) {
unlockoption(form, subitems[i]);
@@ -60,12 +60,16 @@ function lockoptions(form, master, subitems) {
function lockoption(form,item) {
eval("document."+form+"."+item+".disabled=true");/* IE thing */
- eval("document."+form+".h"+item+".value=1");
+ if(document.forms[form].elements['h'+item]) {
+ eval("document."+form+".h"+item+".value=1");
+ }
}
function unlockoption(form,item) {
eval("document."+form+"."+item+".disabled=false");/* IE thing */
- eval("document."+form+".h"+item+".value=0");
+ if(document.forms[form].elements['h'+item]) {
+ eval("document."+form+".h"+item+".value=0");
+ }
}
function submitFormById(id) {

0 comments on commit 027d048

Please sign in to comment.