Run a function on page load using SmartClient

76 Views Asked by At

When the page loads, I want to hide some buttons based on user permissions.

I have a function that does what I need, but currently I have to press a button to call it.

How to run a applyUserPermissions function right after page loads using SmartClient?

function applyUserPermissions(){
    btn.setDisabled(false);
}
1

There are 1 best solutions below

0
Tadija Bagarić On BEST ANSWER

Same as in plain Javascript

The statements are executed, one by one, in the same order as they are written.

~ w3c Javascript School

So like this:

<script>

function applyUserPermissions(){
    btn.setDisabled(false);
}

// calls it on page load
applyUserPermissions();

</script>