Showing posts with label Disable Fields. Show all posts
Showing posts with label Disable Fields. Show all posts

Saturday, June 2, 2012

Make fields Disable / Read only on Entry Forms

If you want to disable fields on New Entry Form or Edit Entry form, Use this code to disable fields :


// Function To Disable Fields
  function disableField(title)
  {
   for(var i = 0; i < document.all.length; i++)
   {
    var el = document.all[i];
    // find html element with specified title
    if(el.title == title)
    {
     el.disabled = true; // disable
     // if the next element has a reference to the current element
     // then disable if as well
     if(i < document.all.length - 1)
     {
      var el2 = document.all[i + 1];
      if(el2.outerHTML.indexOf(el.id) > 0)
      {
       el2.disabled = true;
      }
     }
     break;
    }
   }
   }
   // END Function To Disable Fields 



Call Function within entry form :
disableField("Task Description");
disableField("Comment");
disableField("Status");