error executing JS

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

ilcaa72
Ebase User
Posts: 6
Joined: Thu Jun 22, 2017 2:39 am

error executing JS

#1

Postby ilcaa72 » Thu Jun 22, 2017 11:24 am

hello, here is a screenshot that show an error when executing JS on a push button... can you maybe see why?

Image

https://drive.google.com/open?id=0ByTl_ ... Fg1OVcxUzQ
0 x

Steve
Moderator
Moderator
Posts: 414
Joined: Fri Sep 07, 2007 3:44 pm
Location: Sandy, UK
Contact:

#2

Postby Steve » Thu Jun 22, 2017 11:36 am

Hi,

JavaScript is a case sensitive language.

If you change the line of code:

Code: Select all

tables.myWorldDiscounts.fetchTable();
to

Code: Select all

tables.myWorldDiscounts.fetchtable();
This should fix your problem.

Also I see on the next line you should call:

Code: Select all

controls.table1.show();
to show the table. You are missing the () at the end.

I hope this helps

Steve
0 x

ilcaa72
Ebase User
Posts: 6
Joined: Thu Jun 22, 2017 2:39 am

#3

Postby ilcaa72 » Thu Jun 22, 2017 11:56 am

thanks, i did make the adjustments and still getting same error, it says
' "fetchtable" of undefined '

could it be mysetup of the table... here is screenshot of setup...


https://drive.google.com/open?id=0ByTl_ ... TEhmTGR6LV
0 x

Steve
Moderator
Moderator
Posts: 414
Joined: Fri Sep 07, 2007 3:44 pm
Location: Sandy, UK
Contact:

#4

Postby Steve » Thu Jun 22, 2017 12:57 pm

Hi,

Sorry I misinformed you. The syntax should be fetchTable with a capital T. I misread the error. The error is suggesting that the table does not exist on the form.

Code: Select all

tables.myWorldDiscounts.fetchTable();
Is the table name correct for the fetchTable() function? Does myWorldDiscounts exist in the form?

Your last screen shot link did not work, so perhaps you can send me a screen shot of the Form - 'firstForm'

Kind regards

Steve
0 x

ilcaa72
Ebase User
Posts: 6
Joined: Thu Jun 22, 2017 2:39 am

#5

Postby ilcaa72 » Thu Jun 22, 2017 2:47 pm

thanks, i actually redid the entire resource attachment and the table is displaying... BUT, the button event returns an error , the text box should display a message of the users first and last name... here is a screenshot, of error, code, and setup...

https://drive.google.com/file/d/0ByTl_9 ... sp=sharing
0 x

Steve
Moderator
Moderator
Posts: 414
Joined: Fri Sep 07, 2007 3:44 pm
Location: Sandy, UK
Contact:

#6

Postby Steve » Thu Jun 22, 2017 3:03 pm

Hi,

You need to modify the line:

Code: Select all

controls.text1.text.text = fields.firstName + fields.lastName
to

Code: Select all

controls.text1.text.text = "welcome " + fields.firstName.value + " " + fields.lastName.value 
The important part here is the .value at the end of the field name you are referencing ... this returns the actual value of the field.


Kind regards

Steve
0 x

ilcaa72
Ebase User
Posts: 6
Joined: Thu Jun 22, 2017 2:39 am

#7

Postby ilcaa72 » Thu Jun 22, 2017 4:14 pm

thanks Steve, it fixed it and i learned something...

is there a way to debug the JS script for syntax or other errors? do you have suggestions
0 x

Steve
Moderator
Moderator
Posts: 414
Joined: Fri Sep 07, 2007 3:44 pm
Location: Sandy, UK
Contact:

#8

Postby Steve » Thu Jun 22, 2017 4:23 pm

The JavaScript editor has syntax checking inside it. If there is a red syntax error (little squiggle), you can hover over it and it will tell you the error.

There is no interactive debugger though for JavaScript. This would be a nice edition to Ebase.

Steve
0 x


Who is online

Users browsing this forum: No registered users and 11 guests