Issue fireing a function while column validation

Hello,

I have set a column validation property <servoy.EmailValidator> for “customer_email”. This validation option is working well when the user is leaving the column before fireing a function by clicking a button. If the user is leaving the column by directly clicking the button and the validation get fail, an error occurs “TypeError: Cannot find function xy.”.

I would like to catch that error by function, but I don’t know how to get that condition of Servoy!?

Do anybody have an idea how to solve that issue?

Regards, Thomas

Servoy 5.1.2
Java 1.6_18

i can’t reproduce what you have.

I placed a field that has a email validation column

I also placed a button that also has a method attached to it

I also have an onError method (the default one)

If i change the field (with an error) and click out of it, i get the wrong input dialog

If i change the field and press the button, i get a wrong input dialog and the buttons event is not executed.
So i dont know what exactly your setup is but please create case with a sample.

jcompagner:
If i change the field and press the button, i get a wrong input dialog and the buttons event is not executed.
So i dont know what exactly your setup is but please create case with a sample.

Hi Johan,
I find out that the issue occurs when I click a button in a tabpanel belonging to a modul! The function on the button is for example:

vForm = currentcontroller.getName()
databaseManager.setAutoSave(true)
databaseManager.saveData()
forms[vForm].m_doSave()

In this example I get the “TypeError: Cannot find function m_doSave.”.

If I execute a function on a button placed directly on the form, the result is as your discription.

Hi Johan,

I have tried to reproduce the issue of my customers solution in the Servoy Sample CRM.

I set the Valitation <servoy.EmailValidator> to the column customer_email in udm.companies and
the fld_customerEmail onDataChange property to default.

The tabpanel “tabs_navi” and the button functions on form frm_company are similar to the form in my solution.
When I click on “Edit”, change the email address to an invalid value, let the cursor stay in the field and click the “Print” button… all is working well. I get only the error dialog for the invalid insertation.

So I also cannot reproduce the issue of my solution :cry: . I will check my functions and find out where is raising the problem.

Regards, Thomas

Hi Johan,

it’s me again.

The “TypeError” occurs only on Windows 7! On Mac OS X it works as espected.

Server Information
Servoy version 5.1.2 -build 959

Operating System Information
os.name=Mac OS X
os.version=10.6.3
os.arch=x86_64
JDK Information
java.vm.name=Java HotSpot™ 64-Bit Server VM
java.version=1.6.0_17


Operating System Information
os.name=Windows 7
os.version=6.1
os.arch=x86
JDK Information
java.vm.name=Java HotSpot™ Client VM
java.version=1.6.0_18

The Problem is that my customers environment is mainly Windows 7.

that type error is something else, it doesnt have anything to do with the validation problem (maybe it is related somehow but i dont see how)
The error exactly tells you what the problem is:

this is what you execute:

forms[vForm].m_doSave()

and then this is the error:

TypeError: Cannot find function m_doSave.

so it tells you that forms[vForm] doesnt have that ‘m_doSave’ function…

Can you put some output around it? is vForm the one you expect?

But in the end what shouldnt happen is that the button executes anything, so that whole script shouldnt run.

jcompagner:
Can you put some output around it? is vForm the one you expect?

Yes, vForm is the variable for the form in front and the value is what I expect.
The output around is:
“TypeError: Cannot find function m_doSave. (C:\Users.…\servoy_workspace\team_project\tgs_mod_button\forms\mod_frm_btns_edit.js#85)”
and below the links to the functions

jcompagner:
But in the end what shouldnt happen is that the button executes anything, so that whole script shouldnt run.

Ok, but why does the button execute a function? Why only on Windows 7/XP?
If I open the solution in the Smart Client from my Team Server on a Mac OS X machine the button executes nothing! The validation function works as expected.
Perhaps because the tabpanel belongs to a form of a modul? I will make a try with a form directly in the solution tree.

please output stuff just before the call to m_doSave()

like:

application.output(vForm);
application.output(forms[vForm]);
application.output(forms[vForm].m_doSave);

what does it print?

Does it print the right form name?
does it print the right form?
does it print a function object?

Please make a case in our support system with a sample how to get to the execution of a button event method even when there are validation problems.

I think I got it! The problem is that I take my own dialog from a modul to display the validation error. If I take the plugins.dialogs.showErrorDialog() no TypeError occurs… but at the moment the cursor got out of the column while clicking the button, the solution is blocked and the column is not more editable. In this case the only option is to force quit the Smart Client.

case 290341