Skip to main content
balyai62388398
New Participant
July 18, 2017
Answered

How to make field Read Only after Selecting certain option from dropdown list ?

  • July 18, 2017
  • 2 replies
  • 1803 views

Hi,

i am creating a Dropdown for a team selection, and want the field below to autofield depend on the dropdown selected.

The Dropdown (TeamName) selection are :

Team1

Team2

Team3

the option for the the "Captain" Filed are,

if Team1, "Andy" ; If Team2, "Bob", If Team3, a free text that i can fill in later.

the problem is, i want to have that if Team1 and Team2 is selected the field will be ReadOnly/Protected, if Team3, then we can edit the field.

I've Tried this, the selection is okay, but it wont make the field as readOnly, can anyone help please.

var one = this.getField('TeamName');

var two = this.getField('Captain');

if (one.value == 'Team1')

{

two.value='Andy';

two.access="readonly"

}

if (one.value == 'Team2')

{

two.value='Bob';

two.access="readonly"

}

if (one.value == 'Team3')

{

two.value=' '

}

Thank you

This topic has been closed for replies.
Correct answer try67

um,, i don't have that.

is it possible with Acrobat with other ways?


Use this code as the custom validation script of the drop-down field (make sure to tick the option to commit the selected value immediately, under Properties - Options):

var captainField = this.getField("Captain");

if (event.value == "Team1") {

    captainField.value = "Andy";

    captainField.readonly = true;

} else if (event.value == "Team2") {

    captainField.value = "Bob";

    captainField.readonly = true;

} else if (event.value == "Team3") {

    captainField.value = " ";

    captainField.readonly = false;

}

2 replies

try67
Community Expert
Community Expert
July 18, 2017

Is this an LCD form?

balyai62388398
New Participant
July 18, 2017

sorry, What is LCD Form ?

i made this with Adobe X Pro

Bernd Alheit
Community Expert
Community Expert
July 18, 2017

Look at the console for errors.

balyai62388398
New Participant
July 18, 2017

You mean this should be correct ?

Bernd Alheit
Community Expert
Community Expert
July 18, 2017

It is not correct for a form created with Adobe Acrobat. May be correct for a form created with LiveCycle Designer (LCD).