I have a Form with two fields that I do not want the user to complete. The first field txtCIC is at the top of the Form and only occurs once. The second field txtPICode is within a row instance that the user creates as required. I have another field identified for the person handling the Form to access the two protected fields through entering a code. After updating the two fields the code is removed to protect the fields again.
I inserted the script in the layout:ready event.
if (this.rawValue == "1234") {
PR20.Body.sfFrame.sfProperty.txtCIC.access = "open";
PR20.Body.sfFrame.sfRows.txtPICode.access = "open";
}
else {
PR20.Body.sfFrame.sfProperty.txtCIC.access = "protected";
PR20.Body.sfFrame.sfRows.txtPICode.access = "protected";
}
The script prevents entry to the two fields until the value "1234" is entered and removed. My problem is if I create more than one row instance only row one is protected.
Can anybody please help me?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
this requires a loop to find all instances of the desired fields.
Put this script into the exit:Event.
var nRow = xfa.resolveNodes("PR20.Body.sfFrame.sfProperty[*]");
var nTestValue = "1234";
for (var i = 0; i < nRow.length; i += 1) {
nRow.item(i).txtCIC.access = this.rawValue === nTestValue ? "open" : "protected";
nRow.item(i).txtPICode.access = this.rawValue === nTestValue ? "open" : "protected";
}
Views
Replies
Total Likes
Hi,
this requires a loop to find all instances of the desired fields.
Put this script into the exit:Event.
var nRow = xfa.resolveNodes("PR20.Body.sfFrame.sfProperty[*]");
var nTestValue = "1234";
for (var i = 0; i < nRow.length; i += 1) {
nRow.item(i).txtCIC.access = this.rawValue === nTestValue ? "open" : "protected";
nRow.item(i).txtPICode.access = this.rawValue === nTestValue ? "open" : "protected";
}
Views
Replies
Total Likes
Thank you for taking the trouble.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies