Copy link to clipboard
Copied
I have a two page form that once the user fills out and signs they click the submit button. The submit button has added to it a action mouseup javascript that makes all the fields read only and also generates a template page that is for admin use. So the idea is that once the form is submitted the person receiving the form on the other end will not be able to touch the fields on the first two pages but in the third page generated from the template.
I have two scripts running in the button plus submit form:
The first to generate the template page and hide two buttons:
var a = this.getTemplate ("AdminUse");
a.spawn();
this.getField("Submit").display = display.hidden;
this.getField("Reset").display = display.hidden;
The second to make all fields read only:
//getField("Text_Field").readonly = true;
for(var i=0;i<this.numFields;i++)
{
var fieldName = this.getNthFieldName(i);
if (fieldName == "FOR_ADMINISTRATION_USE_ONLY")
{
//console.println(i+":no:"+fieldName);... used in the debugger
}
else
{
//console.println(i+":"+fieldName);... used in the debugger
getField(fieldName).readonly = true;
}
}
The second script is making everything read only. Which is almost what I want but not quite. I need the field named "FOR_ADMINISTRATION_USE_ONLY" to remain fillable. Please help. What is wrong with the script? I'm struggling to find the correct solution to make that one field fillable.
Couple of issues:
1. You should not have split the code to two "Run a JavaScript" actions, since you can't control the order in which they are executed. Combine them to a single command, as well as the Submit Form action.
2. There's an error in your code. There's no field called "Reset", so this line fails:
this.getField("Reset").display = display.hidden;
Change it to:
this.getField("Reset Form").display = display.hidden;
3. You're spawning the Template using the default settings, which means th
...Copy link to clipboard
Copied
The code seems fine... Are there any error messages when you run it? Are you sure you spelled the field name correctly?
Can you share the actual file with us?
Copy link to clipboard
Copied
I can share a modified version. How can I do that?
Copy link to clipboard
Copied
You can attach it to the original message using the tiny paperclip icon at the bottom when you edit it, or upload it to a file-sharing website (like Dropbox, Google Drive, Adobe Cloud, etc.), generate a share link and then post it here.
Copy link to clipboard
Copied
Here is a google drive link to the file.
https://drive.google.com/file/d/1FNb2xuTcAQ07Jdk1KdZwic4NkaLPQ9id/view?usp=sharing
Copy link to clipboard
Copied
Where's the script located?
Copy link to clipboard
Copied
In the submit button
Copy link to clipboard
Copied
Couple of issues:
1. You should not have split the code to two "Run a JavaScript" actions, since you can't control the order in which they are executed. Combine them to a single command, as well as the Submit Form action.
2. There's an error in your code. There's no field called "Reset", so this line fails:
this.getField("Reset").display = display.hidden;
Change it to:
this.getField("Reset Form").display = display.hidden;
3. You're spawning the Template using the default settings, which means the fields in it are renamed, so there's no field called "FOR_ADMINISTRATION_USE_ONLY" afterwards.
Change the spawn command to:
a.spawn({bRename: false});
Copy link to clipboard
Copied
How do I combine it with the submit form action?
Copy link to clipboard
Copied
Use this command:
this.submitForm({cURL: "mailto:staceykosedy.4@gmail.com", cSubmitAs: "PDF"});
PS. You forget the "mailto:" part in your Submit a Form command, so that wouldn't have worked, either...
Copy link to clipboard
Copied
Ok thank you. I had mailto in there before I modiefied it. Sorry about that. Thanks so much for your help. It works great. I thought that if I stacked the javascript as separate scripts it would control the order it happened. Thank you for clarifying.