tags:

views:

34

answers:

1
try {
  <%if(lBlnBlockScreen){%>
    UTIL_FORM.fVarForm = document.all.frmMain;
    UTIL_FORM.fVarInclude = [
      document.getElementById('INT_GENDER_DROPDOWN'),
      .
      .  
      .
      document.getElementById('INT_JOIN_calender')
    ];
    UTIL_FORM.fnDisableAll();
    document.frmMain.CancelButton.style.display = '';
    document.frmMain.Benefit.style.display = '';
    document.frmMain.DepButton.style.display= '';
    document.frmMain.Companion.style.display= '';
    document.frmMain.Nominee.style.display= '';
  <%}%>
} catch(e) {
      alert(e.message);
}
    fnSetMandatory();    
}

Juz wan to clarify that the above try-catch conditon work or not work? Since the lBlnBlockScreen variable did not consists of value? how can i printout the value of the lBlnBlockScreen ?

In additon, does this method work UTIL_FORM.fnDisableAll() because it seem did not being called. If possible, please help to clarify whether the above code works well or not?

+1  A: 

For starters, do not use:

document.all.frmMain

This is IE only code. use this instead:

UTIL_FORM.fVarForm = document.forms['frmMain'];

Now, with this, if you have defined a method "fnDisableAll()" that is attached to your UTIL_FORM object, (and your JSP condition is true), then yes, it will be called.

Note: To clarify... all of your document.all or document.frmMain statements should either use the DOM0 method of extracting the elements from the document.forms collection or use the generic document.getElementsById(id) or document.getElementsByName(name) methods.

var myForm = document.forms[NameOrIndex];
//or
var myForm = document.getElementById(IdOfForm);
//or
var myForm = document.getElementsByName(NameOfForm)[0];
scunliffe