Copy link to clipboard
Copied
My form has two parts. The user enters in the fields and signs the document then clicks a submit button. Upon clicking the submit button the document becomes read only, generates a template page that SHOULD NOT BE READ ONLY, and links the document to an email.
I had this script working but had to add addiontional fields to the template page that should not be read only. Now it doesn't work. It generates the template page and attaches it to an email, but the template page "Admin Use" is still "Read Only" when it shouldn't be. What's wrong with my script? Please help!
var a = this.getTemplate ("AdminUse");
a.spawn({bRename: false});
this.getField("Submit").display = display.hidden;
this.getField("Reset Form").display = display.hidden;
//getField("Text_Field").readonly = true;
for(var i=0;i<this.numFields;i++)
{
var fieldName = this.getNthFieldName(i);
if (fieldName == "Date_reviewed"
&&fieldName == "Date_Reported"
&&fieldName == "Designated-Recipient_Name"
&&fieldName == "Principal-Party-informed_Notice has been received"
&&fieldName == "Witness contacted"
&&fieldName == "FOR_ADMINISTRATION_USE_ONLY-Additonal Comments")
{
//console.println(i+":no:"+fieldName);... used in the debugger
}
else
{
//console.println(i+":"+fieldName);... used in the debugger
getField(fieldName).readonly = true;
}
}
Change the && to ||
&& means and
|| means or
Copy link to clipboard
Copied
Change the && to ||
&& means and
|| means or
Copy link to clipboard
Copied
It worked thank you. I do know that && means "and" and || means "or" but I don't understand why in this instance using "or" instead of "and" is correct. Would you be able to explain? I would appreciate it so I may better understand for next time.
Copy link to clipboard
Copied
E.g. fieldName == "Date_reviewed"
&&fieldName == "Date_Reported"
This will be never true because a field has only one name.
Copy link to clipboard
Copied
I get it now. Thank you!