Hope here lock means Protected / readOnly access to text field, is this correct?
if so can be done on Change or Exit events using javascript
here is the script
if(xfa.event.newText == "Add") //if need on exit event try with if(this.rawValue == "Add")
{
TextField1.access = "protected"; //TextField1.access = "readOnly";
}else{
TextField1.access = "open";
}
Hope this will help.
RAGHU.