Execute Code on Button Click

Hello,

I’m trying to execute some code when a button is clicked in a form. What’s the best way to do this in Qodly?

Best,
Elliott

Hello Elliott !

To do so:

You can start by clicking on the Open Events Panel icon located in your button’s toolbar:

image

Then, you’ll notice that the contextual panel, that enables you to add multiple actions to your different component’s events, will be expanded:

In here, you can associate your class function to the On Click event of your button, by clicking on the Add a Function call button, and the selecting ,on the right, the code you want it to be executed:

if nothing has changed, i think fadwa’s explanation is incomplete. if something has changed, then, cool, i’m about to learn something.

  • the function you call has to be a dataclass function. if the webform is specific to a dataclass, then that function can just be embedded in the dataclass. for general purpose functions, you can embed the function in the DataStore class.
  • you can call methods and user class functions, indirectly. your button would call a function, which would then call the userclass function or the method.

i see that there will soon be a way to call exposed singleton functions, too. i don’t think that has been announced for qodly, yet, but it will be coming, since it is in the 4d 20 R6 beta

Thank you! That makes sense now.