Tuesday 1 March 2016

Let’s wreck the default Fire on page load option

Do you recognize the situation that you have coded a nice JavaScript Dynamic Action to respond on user input, you run the page and you notice unwanted behaviour when loading the page?
Oh no, forgot to uncheck the Fire on page load option! It happens to me all the time!

In Oracle Apex JavaScript DA steps have the option Fire on page load checked by default, as you will all be aware. PL/SQL steps have it default unchecked.
I stumble regularly over forgetting to uncheck the option. Most of the DA’s I write are about responding on user actions so I normally do not want them to execute on page load. Not unchecking the option results in unwanted behaviour which is not always obvious. One time it has cost me a few hours to come to the conclusion I should uncheck it.

I would like to have the option default unchecked. This ranks high on my Apex enhancement requests list.

To back this I decided to examine how many Javascript DA steps still have the Fire on page load option active in the application I currently work on together with 5 other developers.
This is the result:

Execute on Page LoadNumber
No365
Yes132

The ratio between unchecked and checked is 2,7! A good argument for me to have the option default unchecked.

What about the Apex builder? A query on the Apex repository for application ID’s between 4000 and 5000 results in :

Execute on Page LoadNumber
No86
Yes36

Also in their own work it would be an advantage to uncheck by default!

But how about your application? I am curious what the ratio is in your application.
If you fire the query below you can find out.

select execute_on_page_init, count(*)
from   apex_application_page_da_acts
where  action_code = 'NATIVE_JAVASCRIPT_CODE'
  and  application_name = 'appname
group by execute_on_page_init;

You can fill in the application name at appname or omit this line to query the whole Apex repository.

Please you post the results on www.speech2form.com/da_survey. If your results also show a majority for the unchecked steps I will try to convince the Apex team of unchecking the option by default for JavaScript DA steps.

#letswreckthistogether ;-).

Happy apexing,
Dick Dral

5 comments:

Juergen Schuster said...
This comment has been removed by the author.
Juergen Schuster said...

Hi Dick,

I'm probably at least as annoyed as you about this setting. But if I put myself in the position of a development team member I would probably vote for the default setting. Because DAs are a not so easy to understand feature in APEX compared to all the other funcitonality. And not so many APEX devlopers understand jQuery, AJAX and the architecture of the DOM, Events, etc. Therefore I'm sure we would get much more frustrated Beginners with DAs, because the DA does not do what they expect, if you don't fire it also on Page Load by default. And in 95% of the time it does not really hurt if it fires on Page Load besides the additional round trip. So I think it is the price the experienced ones have to pay in order to give the DA Beginners a better starter experience?

Juergen

Dick Dral said...

Hi Juergen,

thanks for your comment. You might be right about this functionality being good for beginners.
In that case I would opt for an option in the user settings to set the default value for Fire on page Load. This value could be Yes for beginners, enabling more experienced users to set it to No.

Dick

David Lawton said...

Sounds like a good idea to have an option in the user settings to set an application default for this. I like it. Perhaps it could be suggested as a feature request?

education information said...
This comment has been removed by a blog administrator.