This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - The javascript code is not working for me.

Harsha - Monday, August 13, 2012 3:14 AM:

Hi ,

  I tried to disable a text field by using the following code. I am able to disable the field, but the field  is still allowing to enter data in disable mode also. 

The code I used is:

var curr_state = thisItem.getProperty("state");
  var correction = getFieldByName("correction");
 if(curr_state=="New")

{

  if(correction)
{

var correction_Style = correction.style;
   correction.disabled = true;
   correction_Style.visibility = "visible";
   correction_Style.display = "";

}

else{

correction.disabled = false;

}

}

Is there  any mistakes in the above code?

Need help.

Thank you all,

Harsha



fli - Monday, August 13, 2012 6:51 AM:

HI Harsha,

try this:

document.forms[0]."field name".disabled = true;

return;

/ Christoffer



Harsha - Monday, August 13, 2012 11:25 AM:

Hi Christoffer,

Thank you , It worked for me.

And the following is also working.

var field = document.getElementById("field");

field.disabled = true;

 

Thank You

Harsha