Expand my Community achievements bar.

Disable a button under certain circumstances and disable input fields

Avatar

Former Community Member

Scenario: My user receives a PDF (dymanic XML) where they fill in fields and click a Submit button to send the data to the server. They receive a confirmation copy of the form back. In our older version of Livecycle, the confirmation form was locked down - no fields were editable, the Submit button was disabled. We still need the ability to not input/change any data on the confirmation copy and not be able to click the Submit button. Under ES4, everything started out editable.

On the confirmation copy, there are messages that I check. When those messages are present I would like to hide the buttons (optimal solution) or at the very least, disable them so the user cannot resubmit the form again.

I've managed to put Javascript in place to lock down all input fields, I just can't get the script to work to hide the buttons. I'm beginning to wonder if the script to lock down all input fields is causing the scripts to hide the buttons to not work.

Sample code to disable editing of input fields:

- had to provide this code at the table level so that when a table flows to a second page, the fields are locked. When I put it at the page level or top level of the hierarchy, it only worked on the one page when I need it to cover fields that have flowed on to a second page. Even at the table level, there are still some tables that remain open until a change is made, then the fields on the second page become locked.

- when this is entered at the subform level, second page of the subform is modifiable

rfqHeader.rfqHeader.IssuerInfo::ready:layout - (JavaScript, client)

if (rfqHeader.rfqMessages.Message.rawValue != null)

{

// Get the field containers from each page.

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";

}

}

}

Sample code to make the button hidden:

rfqHeader.rfqFooter.button.SubmitButton::initialize - (JavaScript, client)

if (rfqMessages.Message.rawValue != null)

{

this.presence = "hidden" ;

}

Any help and suggestions would be welcome!

Thanks, Josie.

1 Reply

Avatar

Level 10

Hi Josie,

I think, for what you are trying to do, you must be in the doc:ready to be able to do this.

All because the doc:ready is the last event to be fired when a form is reopen...

rfqHeader.rfqFooter.button.SubmitButton::docReady - (JavaScript, client)

if (rfqMessages.Message.rawValue ! = null)

{

this.presence = "hidden" ;

}