Fill a field when the item is locked

Hello ALL,

Is there any way please to fill a field and save  the item when it is locked.

I have tried the code below (client method with the event onFormPopulated) without success as the item is saved but keeps the field empty :

var lock = document.thisItem.getProperty("locked_by_id", "");

if (lock =='' ){

var field =getFieldByName("_champ");


field.getElementsByTagName("input")[0].disabled = false;


field.getElementsByTagName("input")[0].readOnly = false;


}
else {

var fields =getFieldByName("_champ");


fields.getElementsByTagName("input")[0].disabled = true;


}

Parents
  • Hi Mouad

    Below on form populate method might help in this case (This will check whether the document is in edit mode and state = "Preliminary"

    var state = document.thisItem.getProperty("state", "");
    if (document.isEditMode && !aras.isTempEx(document.item))
    {
    if (state === "Preliminary")
    {
    getFieldByName("_champ").getElementsByTagName("input")[0].disabled = false;
    }
    }
    else
    {
    getFieldByName("_champ").getElementsByTagName("input")[0].disabled = true;
    }

    Thank You

    Gobikrishnan R

Reply
  • Hi Mouad

    Below on form populate method might help in this case (This will check whether the document is in edit mode and state = "Preliminary"

    var state = document.thisItem.getProperty("state", "");
    if (document.isEditMode && !aras.isTempEx(document.item))
    {
    if (state === "Preliminary")
    {
    getFieldByName("_champ").getElementsByTagName("input")[0].disabled = false;
    }
    }
    else
    {
    getFieldByName("_champ").getElementsByTagName("input")[0].disabled = true;
    }

    Thank You

    Gobikrishnan R

Children
No Data