0
votes

I'm using Oracle Apex 19.1
I have tabular form that looks like this:

Tabular form

When the user clicks on the button below, I want to copy the entries of the first day ("Lun. 07 Sept.") to the other days of the week.
So far, I've created a dynamic action on click, which executes the following PL/SQL:

BEGIN
    FOR i IN 1..htmldb_application.g_f01.count LOOP
        htmldb_application.g_f02(i) := htmldb_application.g_f01(i);
        htmldb_application.g_f03(i) := htmldb_application.g_f01(i);
        htmldb_application.g_f04(i) := htmldb_application.g_f01(i);
        htmldb_application.g_f05(i) := htmldb_application.g_f01(i);
    END LOOP;

    COMMIT;
END;

Yet, nothing happens when I click the button. Any idea what I'm doing wrong ? Should I use JavaScript instead ?
I verified and the html ids of each select lists are indeed f01_0001, f01_0002, etc. (for the first column as an example).

1
Note that tabular forms are marked legacy for quite a couple of versions now and beginning with APEX 20 are officially deprecated. Oracle recommends switching to interactive grids. - Thomas Tschernich
@ThomasTschernich I know but I am currently working on an application developed on apex 4.2, I've just upgraded it to 19.1 but I won't change how things are done for now. Only new pages/report will be interactive. Thanks for the advice - Kabulan0lak

1 Answers

1
votes

Should I use JavaScript instead?

This is correct. The htmldb_application.g_f02(i) items will only be available when the page is submitted. And is meant to update the database but not to update the DOM elements.

This might help

var f01arr = document.getElementsByName("f01");
var f02arr = document.getElementsByName("f02");
var f03arr = document.getElementsByName("f03");
var f04arr = document.getElementsByName("f04");
var f05arr = document.getElementsByName("f05");
for (i = 0; i < f01arr.length; i++) {

    f02arr[i].value = f01arr[i].value;
    f03arr[i].value = f01arr[i].value;
    f04arr[i].value = f01arr[i].value;
    f05arr[i].value = f01arr[i].value;

}