Hi All
After upgrading to 5.1 from 3.5 I am having difficulty figuring out JSEvents like getFormName. I have a 3.5 method That starts like this;
globals.form_nameƒtrigger = application.getMethodTriggerFormName()
globals.table_nameƒtrigger = forms[globals.form_nameƒtrigger].controller.getTableName()
What would be the correct way to code this for 5.1?
Thanks for the help
ROCLASI
February 26, 2010, 3:43pm
2
Hi Tom,
Just look in the JSEvent node under the Application node in the Solution Explorer. Here you see all properties/functions that JSEvent holds.
Here you see that you can get the formname and the element name that triggered the event.
As for the tablename you need to get the datasource first of the form and then use the databaseManager.getDataSourceTableName() function to get the table from it.
This is changed because a form might not be linked to a table but to a DataSet or another datasource.
So your code would look like this:
globals.form_nameƒtrigger = event.getFormName();
globals.table_nameƒtrigger = databaseManager.getDataSourceTableName(forms[event.getFormName()],controller.getDataSource())
Hope this helps.
Thanks Robert
I implemented your suggestion and the first line finally worked.The second line threw the following error;
ReferenceError: “controller” is not defined.
This is the Code;
globals.table_nameƒtrigger = databaseManager.getDataSourceTableName(forms[globals.form_nameƒtrigger],controller.getDataSource());
ROCLASI
February 26, 2010, 5:34pm
4
Ah sorry, I made a typo. There is a comma in there that should be a period.
globals.table_nameƒtrigger = databaseManager.getDataSourceTableName(forms[globals.form_nameƒtrigger],controller.getDataSource());
Should be:
globals.table_nameƒtrigger = databaseManager.getDataSourceTableName(forms[globals.form_nameƒtrigger].controller.getDataSource());
ptalbot
February 26, 2010, 6:19pm
5
ROCLASI:
Ah sorry, I made a typo. There is a comma in there that should be a period.
globals.table_nameƒtrigger = databaseManager.getDataSourceTableName(forms[globals.form_nameƒtrigger],controller.getDataSource());
Should be:
globals.table_nameƒtrigger = databaseManager.getDataSourceTableName(forms[globals.form_nameƒtrigger].controller.getDataSource());
Hi Robert!
I really think they should active the JavaScript “strict mode” on the forum