Child pages
  • Inheritance Model
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Form inheritance is to extend a form with a other form this will give the original form all the methods/variables/elements/properties of the extending form.
The inheritance is not limited to 1 level, for example if you have form a, form b and form c you can extend form b with a and c with b form c wil then have all the methods/variables/elements/properties of form a, b and c.

Overwrite methods

On the child form you will inherit all the methods of the super form. You can overwrite this method, when you do this servoy will generate a method for you with a call of the super in it.



In the generated method you will see _super.newRecord(event) this will call the original method on the super form. You can remove this if you don't want to call this method anymore or you can put code before of after the call, if you put it after don't forget to move the 'return'.

Sample of code before:

function newRecord(event) {
	vMode = 'new Record'
	return _super.newRecord(event)
}

Sample of code after:

function newRecord(event) {
	_super.newRecord(event)
	city = 'Amersfoort'
	return
}

other options

_super keyword

Limitations: Can only edit some types of properties inherited from a super form, not all. Can't alter any properties of elements or parts. Cannot insert new parts inbetween existing, only after existing parts

Inheritance and Security

Setting the super form on existing form (design or runtime): Parts( and elements?) defined on both child and super form: the super form parts are used

  • No labels