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

APPLICATION - PRODUCT ENGINEERING - Restrict Edit on fields

aravinth_r - Monday, March 5, 2012 5:11 AM:

Hello,

When we create a Part, user is allowed to choose the type. User chooses the type and enters other information and saves the part. Part gets created in the system.

My requirement is that after the part creation, user should not be able to edit the type of part. What is the easiest way to achieve this?

Regards, Aravinth



vishal_trivedi - Friday, March 9, 2012 4:42 AM:

Hi Aravinth,

Use below method and set it at "onFormPopulated" event of PART.

=============================

var item = document.thisItem;
if(item && !top.aras.isTempEx(item))
{
    var innovator = item.newInnovator();
    var itmPart = innovator.newItem("Part","get");
    itmPart.setID(item.getProperty("id"));
    itmPart = itmPart.apply();
    if(itmPart.getLockStatus() == 1)
    {
        var clsFld = document.getElementsByName("classification");
        if(clsFld)
        {
          clsFld(0).disabled = "disabled";
        }
    }
}

==================================================

- Vishal

 



aravinth_r - Friday, March 9, 2012 4:50 AM:

Thanks Vishal. Also, wanted to tell you I implemented the same in a different logic. I checked whether the revision field (major_rev) had value or not. If it had, i disabled the field. Else enabled it.

Regards, Aravinth

var thisItem = document.thisItem;
var vClassificiationField = document.getElementById("classification");
var vRevision = document.getElementById("major_rev");
var revision = vRevision.value;
if(revision != "") {
  vClassificiationField.disabled = true;
} else {
  vClassificiationField.disabled = false;
}