Setting initial value and check validates

Hi all,

Within the new framework I want to do some code when the form (edit mode) is loaded and off course I want to do some validation code on the save.

What is the best way to do this?
Can I change the extended methods by my own?

I dont want to write code into the framework code.
Let me know what is the correct or best way to do this.

Tnx in advance
Derk

Hi Derk,

When you create a form did you set the extendsForm property to svy_nav_base?
If you did this then you have a lot of inherited functions in your form. You can override each of these forms to your own needs.

In your case you should have a look at dc_edit and dc_save, just make sure that you always call the super.dc… function.

hi Jos,

True,

I Have the framework modules
My Core module with a base form and all set of global codes and valuelists etc.

  • base form extendsForm from svy_nav_base
    My Module
  • module form extends my base form
  • tab(panel) form extend my module form.

So if I understand you correctly I can override the forms in my module methods onLoad onShow etc with my own function with a basic code sentence always at the beginning of the function super.dc
Can you also explain why the basic framework method calls are made on all forms? Sounds overkill of method calls to me. Especially because when I run the app in the smart or webclient it is a “compiled” to 1 level code.
Think I am missing something here.

Tnx

So if I understand you correctly I can override the forms in my module methods onLoad onShow etc with my own function with a basic code sentence always at the beginning of the function super.dc

That depends on whether you want your code to run before or after the _super code, but yes.

Can you also explain why the basic framework method calls are made on all forms? Sounds overkill of method calls to me. Especially because when I run the app in the smart or webclient it is a “compiled” to 1 level code.
Think I am missing something here.

What do you mean by ‘basic framework method calls are made on all forms’ ?

jdbruijn:

So if I understand you correctly I can override the forms in my module methods onLoad onShow etc with my own function with a basic code sentence always at the beginning of the function super.dc

That depends on whether you want your code to run before or after the _super code, but yes.

thats what I mean yes.

Can you also explain why the basic framework method calls are made on all forms? Sounds overkill of method calls to me. Especially because when I run the app in the smart or webclient it is a “compiled” to 1 level code.
Think I am missing something here.

What do you mean by ‘basic framework method calls are made on all forms’ ?

If you check the sampleuse database
form customer extendsForm svy_nav_base
form customer_f_dtl extendsForm svy_nav_base
here it comes on the form customer_f_dtl there is a Tabpanel which contains form orders_f_tbl what also extendsForm svy_nav_base

Now because the orders_f_tbl form is loaded into customer_f_dtl why do I extendsForm svy_nav_base on orders_f_tbl (presume it is only used in customer_f_dtl)
So I wonder why it is called/compiled so many times, and not just extended/inherited at the top level form? Just curious, want to now the thought behind it.
tnx

I don’t think this means those functions are called all the time, but rather that all those functions are available for you to reference/override at those forms.
But I don’t know the mechanics behind all this, so maybe someone from servoy can shed some light on this for you.

Tnx Jos,
Can someone from Servoy shed a light?
Tnx in advance

What Jos is saying is correct, you have all the method on the your form and they will be called when needed.

The best place to put your validation is on your form and override the dc_save_validate method, do a super call and then your own code.