Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

I need to grey out the field at 2 locations?

Avatar

Level 8

Hello

I have page1 and page3 in my_form. Page1 has field with caption 'COUNTRY', Page3 also has the same field (Caption is COUNTRY's NAME), and BINDed with same data source, and the NAME is same in BINDING tab, in both fields NAME is UR_COUNTRY in BINDING tab, fine.

Requirement is to make it grey out (at 2 locations, its Page 1 and Page 3) and ReadOnly as well, so, i am wring the below Java Script in my_form's docReady event

my_form.Page1.Address.COUNTRY.access = "readOnly"

xfa.resolveNode("my_form.Page1.Address.COUNTRY.ui.#textEdit.border.fill.color").value = "192,192,192";

Its greying out in Page1's COUNTRY field, but NOT greyinh out the Page'3 COUNTRY's NAME field!! not sure why?

Pls. let me know How can i do it WITH OUT code redenncy (code redenency is not accepting against standards here)?  I do not want to repeate the code again in Page3's COUNTRY's NAME field initialization event

Thank you

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

In your script you are only referencing the object on Page1. If you also want to change the appearance of the object on Page3, then you will need to duplicate the lines and reference that object specifically.

Also, you can make the fill color script a bit leaner/generic:

COUNTRY.ui.oneOfChild.border.fill.color.value = "192,192,192";

Hope that helps,

Niall

View solution in original post

3 Replies

Avatar

Level 10

Did you try placing the second line of code in the same DocReady event?

my_form.Page3.Address.COUNTRY.access = "readOnly"

xfa.resolveNode("my_form.Page1.Address.COUNTRY.ui.#textEdit.border.fi ll.color").value = "192,192,192";

Thanks

Srini

Avatar

Level 8

Thank you.

All (2 lines) the code am placing in docReady event of my_form , i mean, at FORM level/Top level

Not working!

Any thoughts?    

Avatar

Correct answer by
Level 10

Hi,

In your script you are only referencing the object on Page1. If you also want to change the appearance of the object on Page3, then you will need to duplicate the lines and reference that object specifically.

Also, you can make the fill color script a bit leaner/generic:

COUNTRY.ui.oneOfChild.border.fill.color.value = "192,192,192";

Hope that helps,

Niall