Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Marking fields read only when emailing...

Avatar

Level 2

Ok, I know this is possible I just don't know what the syntax is to do it, so hopefully one of you gurus can point me in the right direction.

I have a dynamic form that is adding rows.  I have been asked by the muckety mucks to mark the fields as read only once they have clicked on the email submit button.

I have it working for the static fields but don't know how to do it for the dynamic rows.

I'm assuming I would need to do a for loop but would it be on the index?

Here is what I have in formcalc, but I am getting an error at the end of the second line:

foreach element in ("Table.Table1.Row2[*]) do

Table.Table1.Row2.Remove[*].access="readOnly"

Table.Table1.Row2.QTY2*].access="readOnly"

Table.Table1.Row2.DESC2[*].access="readOnly"

Table.Table1.Row2.PRICE2[*].access="readOnly"

Table.Table1.Row2.PER2[*].access="readOnly"

endfor

Clearly I don't have a good grip on coding for Livecycle, can someone provide me with some assistance, please.

Thanks much

7 Replies

Avatar

Former Community Member

Your missing a brace.

Table.Table1.Row2.QTY2*].access="readOnly"

should be

Table.Table1.Row2.QTY2[*].access="readOnly"

Steve

Avatar

Level 2

Sorry, that was a typo inputting it into this site.  The error I am getting says that the error is a syntax error at the end of line two:

Table.Table1.Row2.Remove[*].access="readOnly"

Since this isn't Javascript, it shouldn't require a semicolon, correct?  Is the logic correct for the first line:

foreach element in ("Table.Table1.Row2[*]) do

Thanks again everyone.

Avatar

Former Community Member

My preference is JavaScript for this type of functionality. The attached contains a table representing a purchase order. The part number and quantity are user entered optional. I added a button and the click event to make the cells read only as follows:

// form1.purchaseOrder.total.readOnlyBtn::click - (JavaScript, client)


var cnt = form1.purchaseOrder._detail.count;

for (i=0; i < cnt; i++) {

  xfa.resolveNode("form1.purchaseOrder.detail[" + i + "].partNum").access = "readOnly";

  xfa.resolveNode("form1.purchaseOrder.detail[" + i + "].partQty").access = "readOnly";

}

Steve

Avatar

Level 2

I must be missing something.  I added the following code to my form and changed the rest of the lines to (I believe) work in Javascript and now none of the fields are showing up as read only. Here is my coding for the Email button is clicked:

Table.Table1.Row1.QTY1.access="readOnly";
Table.Table1.Row1.DESC1.access="readOnly";
Table.Table1.Row1.PRICE1.access="readOnly";
Table.Table1.Row1.PER1.access="readOnly";

var cnt = form1.PurchaseOrder.Table.Table1.Row2.Remove.count;
for (i=0; i < cnt; i++)
{
  xfa.resolveNode("form1.PurchaseOrder.Table.Table1.Row2.Remove[" + i + "]").access = "readOnly";
  xfa.resolveNode("form1.purchaseOrder.Table.Table1.Row2.QTY2[" + i + "]").access = "readOnly";
  xfa.resolveNode("form1.purchaseOrder.Table.Table1.Row2.DESC2[" + i + "]").access = "readOnly";
  xfa.resolveNode("form1.purchaseOrder.Table.Table1.Row2.PRICE2[" + i + "]").access = "readOnly";
  xfa.resolveNode("form1.purchaseOrder.Table.Table1.Row2.PER2[" + i + "]").access = "readOnly";
  xfa.resolveNode("form1.purchaseOrder.Table.Table1.Row2.TOTAL2[" + i + "]").access = "readOnly";
}

I wanted to attach my PDF file but I don't see how to attach PDF files, only video or images.

Again, thanks for you assistance with this.

Avatar

Former Community Member

If you forward the form to stwalker.adobe@gmail.com I would be happy to take a look.

Steve

Avatar

Level 2

Steve -

I emailed you the PDF file but I haven't heard back if you received it so I don't know if your spam filter caught it.

Thanks for your help!

Avatar

Level 1

Hi ChiTriGuy67,

If you are using Reader 9 or Reader X.  You could set the root node of a PDF form to "readOnly" to lock the whole PDF.

E.g.  rootNode.access = "readOnly"