Execute JSMethod

Discuss all feature requests you have for a new Servoy versions here. Make sure to be clear about what you want, provide an example and indicate how important the feature is for you

Execute JSMethod

Postby martinh » Fri Jul 10, 2009 4:50 pm

Is it possible to add an execute method to the JSMethod object?

JSMethod.execute( array of arguments)

I would like to use it for the following reason:

I want to make changes to my form using the solutionmodel
I noticed when I add this coding in the onLoad trigger of the form, that this is too late; the changes made by the solution model are not accepted.

So I need to make these changes before load (on load of the solution)
But I also want to use a form method to make these changes.

So if there is a onPreLoad method on my form, I want to execute this:

Code: Select all
   var _form_array = forms.allnames;
   var _form
   var _js_form
   var _preload_method
   for (var i = 0; i < _form_array.length; i++)
      _form = _form_array[i]
      _js_form = solutionModel.getForm(_form)
      _preload_method = _js_form.getFormMethod('onPreLoad')
      if (_preload_method)

The problem is, that the form itself is also loaded. So if the


could be replaced by


and the form is not loaded when executing this method, then it would wonderful.

I know I could make these onPreLoad methods globals, but I want it to keep with my forms.

Can this be realised?

Servoy Developer
Version 5.2.10/5.2.13
Java version 1.6 update 31
Database SQL Server 2008 R2
Posts: 857
Joined: Wed May 09, 2007 5:34 pm
Location: Belgium

Re: Execute JSMethod

Postby mboegem » Fri Jul 10, 2009 10:14 pm

Hi Martin,

everything you 'touch' with a connection to a certain form, will cause this particular form to load.
So even if executing this method could be done the way you describe (and I'm not aware of something like this) it will load the form.

This is also one of the reasons that we started to use '_methods' forms. These are not really forms in the way of UI, but placeholders for code that concern a certain group of forms.
For example: you could have a bunch of forms that will have everything todo with appointments.
We described the forms like: 'Appointment_dtl', 'Appointment_tbl', but also 'Appointment_methods'. The actual code for 'onPostNewRecord' will be in the '_methods' form. The '_dtl' and '_tbl' forms can also have an 'onPostNewRecord' method which will just call the '_methods' method with passing arguments like triggerform/elementname.

Hope this idea can help you out.
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance SAN Developer

User avatar
Posts: 1533
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Execute JSMethod

Postby jcompagner » Tue Jul 14, 2009 3:26 pm


what you want is impossible that is mixing of runtime with the solution model which isnt supported.

you cant have a form method that alters its own form.

you have to use what is described above, use a empty form that is just used s a scope for methods
something like solutionModifierForm

that has the methods you want to alter the form.
Johan Compagner
User avatar
Posts: 8302
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Return to Discuss Feature Requests

Who is online

Users browsing this forum: No registered users and 2 guests