Ok - I think I need help from a JS whizz! I have one text field in a form that should only be changed by the manager before he sends it to a client. The client then fills in the form, but cannot change this one text field. I imagine a password javascript would be the best way to do this as the manager would only be using Reader.
I have found this script from a previous post - it's nearly there, but it doesn't allow the change to happen, it just automatically changes the field to read-only and back etc. I want to be able to change the text in the field, and then that change is only allowed once the password has been approved. If it needs changing again, you need to put a password in...
(function () {
// Get one of the fields in the group
var f = getField("private.name");
// Determine new readonly state, which
// is the opposite of the current state
var readonly = !f.readonly;
var readonly_desc = readonly ? "deactivate" : "activate";
// Ask user for password
var resp = app.response({
cQuestion: "To " + readonly_desc + " the fields, enter the password:",
cTitle: "Enter password",
bPassword: true,
cLabel: "Password"
});
switch (resp) {
case "your_password": // Your password goes here
getField("private").readonly = readonly;
app.alert("The fields are now " + readonly_desc + "d.", 3);
break;
case null : // User pressed Cancel button
break;
default : // Incorrect password
app.alert("Incorrect password.", 1);
break;
}
})();
I'm putting this is in the 'text field properties' 'actions' with the 'mouse up' 'run a javascript' selected. Perhaps a custom validation script may also work - but I'll leave it with the experts! Any help MUCH appreciated!