These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Disabling all buttons with one submiting button

quillerpl
Registered: Feb 12 2010
Posts: 14
Answered

I have just finished a form which includes number of buttons which add/remove instances. The form will be operated by users on two tiers. First one will prepare the form adding necessary instances while the end user should only fill in text fields and select some radio buttons.

I need an assistance in disabling (making them invisible will be also ok) all buttons in the form by pressing one button or checkbox.
I founded a script which makes all fields readOnly while pressing Submit button but it's not what I am looking for.
I named all the buttons with btt1, btt2 etc, but they are on different levels and also there will be as many of them as many times new instance will be added by the middle user.

I suspect that it can be done with resolveNodes but frankly I have no idea how to use it to find all buttons in my form, especially if they are located on different levels.

I would be very grateful for help.

Thx in advance
Jack

My Product Information:
LiveCycle Designer, Windows
pforms
Registered: Nov 17 2009
Posts: 87
maybe something like this:

for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++) {
var oFields = xfa.layout.pageContent(nPageCount, "field");

var nNodesLength = oFields.length;
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {
if (oFields.item(nNodeCount).ui.oneOfChild.className != "button")

{
oFields.item(nNodeCount).access ="readOnly";
}
}
}
quillerpl
Registered: Feb 12 2010
Posts: 14
Hi Paul

I tried your script but it makes all fields readOnly. Maybe I am doing sth wrong. Or maybe I should somehow tune up your script to my form.

I ascribed it to one of my buttons and after pressing it all my buttons are still working.

Any other suggestions?

Thx in advance
Jack
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Read the code posted carefully.

The line that reads:

Quote:
if (oFields.item(nNodeCount).ui.oneOfChild.className != "button")
Is processing fields that are not buttons!

Change the comparison operator to test for equal.

George Kaiser

quillerpl
Registered: Feb 12 2010
Posts: 14
I had to overlook it. After changing to the operator to equal everything works smoothly.

Thank you Paul for the script and thank you gkaiseril for pointing out the 'inequality' problem.

Jack