Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.
SOLVED

Assign the value of a table to a text field

Avatar

Level 1

Hi,

I need to assign the value of a table to a text field, but the coordinates of the table are obtained from concatenating two values ​​(determined according to the selection of two radiobutton groups)

How I can do?

I get the correct text as assigned to the text field "COORDINATES" directly, and this work:

     DATATABLE_TEXT.rawValue = TABLE_1.A_2.B_3.rawValue;

 

But, if i call the sentence concatenating the coordenate values A_2 + "." + B_3, with the result of

the radiobutton selecction, and doesn't work.

i've tried with this code:

 

Formulari1.PAGE_1.OPTIONS_A::click - (JavaScript, client)

    COORDINATES.rawValue = "A_" + OPTIONS_A.rawValue + ".B_" + OPTIONS_B.rawValue;   

Formulari1.PAGE_1.OPTIONS_B::click - (JavaScript, client)

   COORDINATES.rawValue = "A_" + OPTIONS_A.rawValue + ".B_" + OPTIONS_B.rawValue;

Formulari1.PAGE_1.BUTTON::click - (JavaScript, client)

   //--- this sentence work ok -------------------------

    DATATABLE_TEXT.rawValue = TABLE_1.A_2.B_2.rawValue;

    //--- this sentence doesn't work ------------------------

     COORDINATES.rawValue = "A_2.B_2";

    DATATABLE_TEXT.rawValue = TABLE_1.(COORDINATES.Value).rawValue;

 

    //--- this sentence doesn't work ------------------------

   COORDINATES.rawValue = "A_2.B_2";

    DATATABLE_TEXT.rawValue = TABLE_1.(COORDINATES.rawValue).rawValue;

-----------------------------------------------------------------------

the objects are:

radiobuttons grups and radiobuttons names:

OPTIONS_A

    A_1

    A_2

    A_3

OPTIONS_B

    B_1

    B_2

    B_3

table and row/col names:

TABLE_1

    HEADER_ROW

    A_1

        HEADER_COL

        B_1

        B_2

        B_3

    A_2

        HEADER_COL

        B_1

        B_2

        B_3

    A_3

        HEADER_COL

        B_1

        B_2

        B_3

text fields named:

    COORDINATES

    DATATABLE_TEXT

button fiel named:

    button

------------------------------------------------

a captured image:

table2.jpg

1 Accepted Solution

Avatar

Correct answer by
Level 1

You need to use the "resolveNode" function in order to reference the objects correctly.

In the script executed by the button, place the following:

var selectedRow = TABLE_1.resolveNode("Page1.OPTIONS_A").rawValue;

var selectedColumn = TABLE_1.resolveNode("Page1.OPTIONS_B").rawValue;

txtTableValue.rawValue = TABLE_1.resolveNode(selectedRow + "." + selectedColumn).rawValue;

The only other thing you need to do, it to set the value in your radio button binding to A_1, A_2, etc for each of the radio buttons.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 1

You need to use the "resolveNode" function in order to reference the objects correctly.

In the script executed by the button, place the following:

var selectedRow = TABLE_1.resolveNode("Page1.OPTIONS_A").rawValue;

var selectedColumn = TABLE_1.resolveNode("Page1.OPTIONS_B").rawValue;

txtTableValue.rawValue = TABLE_1.resolveNode(selectedRow + "." + selectedColumn).rawValue;

The only other thing you need to do, it to set the value in your radio button binding to A_1, A_2, etc for each of the radio buttons.

Avatar

Level 1

thank you very much TashaEls, it works correctly