Expand my Community achievements bar.

Script does not behave the same between two forms

Avatar

Level 3

I have two forms with the following script in the mousedown event (Java Script run at Client)

for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++) {

var oFields = xfa.layout.pageContent(nPageCount, "field");

var nNodesLength = oFields.length;

// Set the field property.

for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {

oFields.item(nNodeCount).access = "readOnly";

}

}

Its essentialy supposed to lock the fields once a user clicks on an email submit button. On one form it works perfectly. On the other is will not lock the fields and for the life of me I can figure out why. The only difference I can readily see is the form that works has this at the top of the script windows:
Working Form
form1.#subform[0].Email::mouseDown - (JavaScript, client)
Broken Form:
topmostSubform.Page1.P.Email::mouseDown - (JavaScript, client)
Possibly the form structure is messed up or something. Any help would be greatly appreciated!
7 Replies

Avatar

Level 10

Did you try the below setting to automatic..

https://acrobat.com/#d=DdcaswsjCu9LbY7hR-HfRQ

If you still have issues, you can post both the forms to LiveCycle9@gmail.com, so I can have a look at them..

Thanks

Srini

Avatar

Level 3

Update to original question.

This is the scripting on the form that does not work (placed in mouse down event on submit button):

topmostSubform.Page1.P.Email::mouseDown - (JavaScript, client)

for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++) {

var oFields = xfa.layout.pageContent(nPageCount, "field");

var nNodesLength = oFields.length;

// Set the field property.

for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {

oFields.item(nNodeCount).access = "readOnly";

}

}

This is the scripting on the form that does work (placed in mouse down event on submit button):

form1.#subform[0].Email::mouseDown - (JavaScript, client)

for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++) {

var oFields = xfa.layout.pageContent(nPageCount, "field");

var nNodesLength = oFields.length;

// Set the field property.

for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {

oFields.item(nNodeCount).access = "readOnly";

}

}

Action is to be when use click on the button, button 'locks' all fields (by setting to read only) and attaches PDF to email. Broken form does not lock fields but instead attaches the PDF in which fields can be edited?

Avatar

Level 3

Ok, this is driving me nutz! Does anyone have any insight? I've been @(*$&(@# with this for a while now and I'm not any closer to a fix....

Avatar

Former Community Member

Can you send the forms to LiveCycle8@gmail.com (both the working and the nonworking form) and I will have a look. Please indicate how to duplicate the issue.

Paul

Avatar

Level 3

Thanks Paul!

Ok. Form "New Residential Lease" works fine. Function I'm trying to replicate is when you click on the email button, it sets all fields to read only and attaches to an email as a PDF file. Works perfectly.

Same functionality with same scripting in "Deposit Agreement" does not work and I'm baffled as to why?

Avatar

Former Community Member

Did you attach the forms to your email? If so that will not work as they are filtered out by the forum. That is why I need you to email them to the address listed above.

paul

Avatar

Level 3

Sorry, sent to incorrect address, just early here. Give me a sec to resend.