Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Jul 17, 2017 Jul 17, 2017

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

TOPICS
Acrobat SDK and JavaScript , Windows
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 18, 2017 Jul 18, 2017

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 =

...
Translate
Community Expert ,
Jul 18, 2017 Jul 18, 2017

Look at the console for errors.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 18, 2017 Jul 18, 2017

You mean this should be correct ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 18, 2017 Jul 18, 2017

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 18, 2017 Jul 18, 2017

um,, i don't have that.

is it possible with Acrobat with other ways?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 18, 2017 Jul 18, 2017

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;

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 20, 2017 Jul 20, 2017
LATEST

thats working great!!

thanks man.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 18, 2017 Jul 18, 2017

Is this an LCD form?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 18, 2017 Jul 18, 2017

sorry, What is LCD Form ?

i made this with Adobe X Pro

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines