I have this javascript on my form submit button, (which submits as a pdf.)
form1.MainPage.Submit::preSubmit:form - (JavaScript, client)
if (form1.execValidate() == true)
{
form1.MainPage.Submit.presence="invisible";
form1.access="protected";
}
The problem is I do not want the form fields to be protected until all fields have been validated. After validation I want the entire pdf locked before the pdf is submitted. I have this script in the pre-submit event but it is ignoring the "form1.access="protected";" code.
The pdf cannot lock until all required fields have been filled in. It must lock before submission so that the recipient of the form cannot edit it. I'm really trying to avoid having 2 submit buttons or some solution along those lines. I'm at a loss why I can't get the fields to protect inside the "if" script?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
I am not sure why the preSubmit isn't catching the change in access. Possibly it is too close to the submit process. You could this in the mouseUp event of the submit button. This fires immediately prior to the click event, so should be completed when the submit process starts.
if (form1.execValidate() == true)
{
form1.access = "protected";
}
Note however that this will lock everything, including buttons. Once the access is changed to protected you will have no way of changing back to open, unless you build in some mechanism.
Overall Paul's solution is better, because it does keep buttons open, which would be better as the submission may fail and the user may want to resubmit. There are ways around this as well. Overall I would still recommend Paul's solution.
There is a screenshot and explanation here: Re: Saving Fillable Form as non-fillable PDF
Hope that helps,
Niall
Views
Replies
Total Likes
Hi,
Paul has a great solution for this. If you do a search on the forum for "LockAllFields" and have a look at the script object. This contains a function that he calls from the lock button.
Good luck,
Niall
Views
Replies
Total Likes
I read that thread but I couldn't figure out how to get "LockAllFields" to work.
I've been working on this for several days...
It comes down to this:
If I put
form1.access="protected"; in a post-submit it will lock the form but not the submitted pdf
If I put that exact same script in a pre-submit it just ignores it and doesn't lock the form.
Why does this have to be so complicated, lol. All I want is the ability to, pending a successful form validation, lock all fields prior to submission so the recipient cannot edit the form they get.
Views
Replies
Total Likes
Hi,
I am not sure why the preSubmit isn't catching the change in access. Possibly it is too close to the submit process. You could this in the mouseUp event of the submit button. This fires immediately prior to the click event, so should be completed when the submit process starts.
if (form1.execValidate() == true)
{
form1.access = "protected";
}
Note however that this will lock everything, including buttons. Once the access is changed to protected you will have no way of changing back to open, unless you build in some mechanism.
Overall Paul's solution is better, because it does keep buttons open, which would be better as the submission may fail and the user may want to resubmit. There are ways around this as well. Overall I would still recommend Paul's solution.
There is a screenshot and explanation here: Re: Saving Fillable Form as non-fillable PDF
Hope that helps,
Niall
Views
Replies
Total Likes
Paul's solution worked perfectly.
What was strange was if I tried to protect the whole form inside my:
if (form1.execValidate() == true)
{
form1.MainPage.Submit.presence="invisible";
app.runtimeHighlight = false;
form1.access="protected";
}
the fields were not protected and it was basically ignored when using the script in a pre-submit event. It did work in a post-submit event.
If I used:
if (form1.execValidate() == true)
{
form1.MainPage.Submit.presence="invisible";
app.runtimeHighlight = false;
form1.MainPage.FieldName.access="protected";
}
it worked in a pre-submit event, (but obviously only for the specific "FieldName" field in my form... I did not want to have to script in this for every field in my form. I still don't understand why just protecting form1.access didn't work but Paul's solution was great and will be the method I will use from now on.
Thanks again for your help!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies