Monday 19 February 2024

Oracle APEX - beware of the "Quick Edit" button while editing the code in a popup editor!

I bumped into a problem with Oracle APEX App Builder while editing the page and been able to reproduce it on apex.oracle.com (current APEX version 23.2.4).

So, what happened was - the JavaScript code I was editing in the JavaScript popup editor overwrote item's label! This happened when I used the "Quick Edit" button in the running page and selected a page item with the editor still open.

Popup editors in the Page Designer are modal and this should prevent user from selecting another object while they are open... but with Quick Edit button this can be achieved and can lead to a problem if changes in the editor are accepted.

Other editors like PL/SQL editor or CSS editor behave in the similar way, but they are overwriting another item attributes... not necessarily the label. For example PL/SQL editor is overwriting text item's subtype, CSS editor is overwriting Template Options, File URL editor is is overwriting text item's Column attribute... HTML editor is overwriting the text item's label, similar to the JavaScript editor.

Beside those editors I mentioned, other editors might have the same behavior but I haven't tested them all.

Let me show You what I did, step by step.

The Page Setup

I created a really simple page with one region, 2 items and one button.

When I run the page it looks like this

Dynamic Action and JavaScript editing

I created a dynamic action on button, which contain one "Execute JavaScript Code" action:



Run the page and with the "Quick Edit" button I selected P50_SOME_TEXT item:



Back in the Application Builder P50_SOME_TEXT item got selected, but the JavaScript edit popup window was still displayed.



And when I click on the green OK button in the JavaScript editor... the JavaScript code overwrites the text item's label! Like this:

JavaScript code changes are not saved back in the dynamic action but rather in item's label, replacing it. And if You save page changes... You lose the item's label text. And undo is not helping.

You will also lose the changes in the code, which was edited.

Conclusion

Be very careful with the Quick Edit button and editors. 

Combined, they can cause You frustration(s). 

In my opinion the APEX development team should prevent focus change if any editor is open in the Page Designer.

An update

My finding is evidenced as an APEX Bug 36315116.


No comments:

Post a Comment