stefbrt
October 25, 2012, 10:47am
1
Hi all
I have 2 forms, a basic form and a extended form. I want to call a method from the basic form with the instance of the extended form. Everything works fine, but there is a warning in the developer that the method is undefined for the extended form. The definition of the method is in the basic form and because the extended form extends the basic form it should be no problem. So why is there a warning?
Regards, Stef
Is the method in the base form marked private?
stefbrt
October 25, 2012, 11:28am
3
I think it is not marked as private. But where do I have to look. Scope is empty, commentary is empty too. In the Solution Explorer the method is shown in both forms.
Regards, Stef
Hi Stef,
you should look in the methods of the parentform.
Most likely there’s a ‘@private ’ JSDoc annotation in the header of this particular method.
If you make that ‘@protected ’ you will see the warning is gone.
A description of both annotations can be find here http://wiki.servoy.com/display/public/DOCS/Annotating+JavaScript+using+JSDoc
In the Parent form there is no @private , protected oder public annotation in the header. This is not the problem which generates the Warning.
Regards, Stef
Maybe post some code snippet for us to have a look?
The code of the method call is:
/**
*
* @properties={typeid:24,uuid:"b36e6857-5983-41a8-9ba4-2e8e4f8b11c7"}
*/
function teaOnActionPrevious() {
var lastCurrent = globals.teaPlanningFormCurrentPage;
globals.teaPlanningFormCurrentPage -= 1;
globals.teaPlanningFormCurrentPage = Math.max(1, globals.teaPlanningFormCurrentPage);
if (lastCurrent == globals.teaPlanningFormCurrentPage) {
// Nothing to do, last page was already reached.
return;
}
application.closeFormDialog(forms[globals.teaPlanningFormName + lastCurrent]);
forms.TeaWorkQuotaPlanningSelection.createForm();
}
The first lines and the JSDoc of the method is:
/**
*
* @properties={typeid:24,uuid:"20ed1482-cd20-43c4-bcfd-50d3a43f116d"}
*/
function createForm() {
/*
Title: The dynamic form is created. Given is data basis and the page number (displayed columns)
Author: Birgit Rieder
Created: 28.08.2009
Modified: -
Arguments: -
Returns: -
Notes: -
*/
var formName = globals.teaPlanningFormName + '_' + planningCounter + '_' + globals.teaPlanningFormCurrentPage;
if (solutionModel.getForm(formName)) {
application.showFormInDialog(forms[formName], null, null, globals.teaPlanningFormWidth + 20, globals.teaPlanningFormHeight + 20, 'i18n:hades.tea.dialog.title.workQuotaPlanning', false, false, formName, false);
return;
}
// Wieso sind diese Variablen hier und als Form Variable definiert?
var formNameLessons = globals.teaPlanningFormLessonsName + globals.teaPlanningFormCurrentPage;
var formNameSummary = globals.teaPlanningFormSummaryName + globals.teaPlanningFormCurrentPage;
var headerHeight = 50;
var summaryHeight = 100;
var buttonBarHeight = 66;
var lessonsHeight = Math.min(50 + 19 * teacherIds.length, maxFormHeight - headerHeight - summaryHeight - buttonBarHeight);
var textFieldLength = 200;
var numberFieldLength = 50;
var fieldHeight = 18;
var buttonWidth = 68;
var buttonHeight = 26;
var pagesLabelWidth = 50;
globals.teaPlanningFormHeight = headerHeight + lessonsHeight + summaryHeight + buttonBarHeight;
I have seen this before and fixed it by using this workaround:
change this line:
forms.TeaWorkQuotaPlanningSelection.createForm();
to this:
forms['TeaWorkQuotaPlanningSelection'].createForm();
Try it and see. I am not sure why, but it seems the parser may not be able to do it properly. Perhaps Servoy knows the answer?
Hi Stef,
1 other question, are those methods in different modules?
ptalbot
October 31, 2012, 10:05pm
10
Yes, it looks like a module dependency issue.
stefbrt
November 1, 2012, 8:24am
11
No both Forms are in the same Module.
ptalbot
November 1, 2012, 11:30am
12
Have you tried cleaning the solution (Menu Project > Clean)?
Sometimes errors/warnings are not cleared automatically at startup (a build failed to clear them).
ptalbot
November 1, 2012, 11:35am
13
Also does the TeaWorkQuotaPlanningSelection.frm has a TeaWorkQuotaPlanningSelection.js (look in your workspace)?
If not, and I’ve seen this many times, you have to create one (simply open this form in javascript editor) before the super form’s methods are recognized.
If that’s the case, maybe you could open a case on the support system…
stefbrt
November 1, 2012, 11:36am
14
Yes I clean and build it new. I exported and imported the solution in an new workspace. But the warning comes always.
stefbrt
November 1, 2012, 11:37am
15
Yes both forms has an .js File! And both have functions in it.
ptalbot
November 1, 2012, 11:47am
16
Where is the teaOnActionPrevious() method located?
And what version of Servoy is this?