Copy link to clipboard
Copied
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
1 Correct answer
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 =
Copy link to clipboard
Copied
Look at the console for errors.
Copy link to clipboard
Copied
You mean this should be correct ?
Copy link to clipboard
Copied
It is not correct for a form created with Adobe Acrobat. May be correct for a form created with LiveCycle Designer (LCD).
Copy link to clipboard
Copied
um,, i don't have that.
is it possible with Acrobat with other ways?
Copy link to clipboard
Copied
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;
}
Copy link to clipboard
Copied
thats working great!!
thanks man.
Copy link to clipboard
Copied
Is this an LCD form?
Copy link to clipboard
Copied
sorry, What is LCD Form ?
i made this with Adobe X Pro

