what is new for web service on 4.5.1

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

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

what is new for web service on 4.5.1

#1

Postby xren » Tue Apr 08, 2014 2:07 pm

Hi,

What is new for 4.5.1 about web service?

I have a field need to have autocomplete function. That will need to call a web service to provide the promoted choices. I also need to create the web service which get data from a db table.

What the difference there will be between 4.5.1 and 4.4.2 for the above things I need to do

Thanks,
Xiaoli
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Tue Apr 08, 2014 3:28 pm

Xiaoli,

There is a general browser security restriction that stops you calling a web service from your client-side Javascript unless the web service has the same domain as the current session. V4.5 introduces the client API that solves this problem by getting the server to call the web service. So, from your client-side Javascript you call a server-side Javascript function which in turn calls the web service and returns the result to the client.

Regards
Jon
0 x

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

#3

Postby xren » Tue Apr 08, 2014 7:37 pm

Thank you Jon,

Could you send me the link to the document about this client side API web service call ?
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#4

Postby Jon » Wed Apr 09, 2014 7:27 am

Here is the doc for the client API - this just lets you call the server from the client. You would then need to use a Web Services Resource on the server to call the web service i.e. normal server-side scripting.

http://dev-docs.verj.io/ufs/doc/Working ... nt_api.htm

You would use $eb.executeFunction() to invoke a function.
0 x

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

#5

Postby xren » Thu Apr 17, 2014 6:05 pm

How about return multiple columns and bind to multiple fields ?

Thanks,
Xiaoli
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#6

Postby Jon » Tue Apr 22, 2014 10:08 am

Take a look at this example http://forum.ebasetech.com/forum/viewtopic.php?t=522. It uses a combination of autocomplete and the client api to display a list then sets the values of additional form fields depending on the selection. Is this what you want to do?
0 x

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

#7

Postby xren » Thu Apr 24, 2014 1:07 pm

This is a very good example.

Thank you Jon.
Last edited by xren on Thu Apr 24, 2014 1:46 pm, edited 1 time in total.
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#8

Postby Jon » Thu Apr 24, 2014 1:31 pm

At the moment it's v1.10.2, but it may be upgraded at any moment - that's the idea.
0 x

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

#9

Postby xren » Thu Apr 24, 2014 7:27 pm

Another problem:

It works fine with single fields.

However, when I use this solution on table column a and want to set column b using the returned value, it cannot set column b - the "client accessibility" for column b's field is disabled.

How can this be done?

Thanks,
Xiaoli
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#10

Postby Jon » Fri Apr 25, 2014 7:37 am

That's right. You can only use $eb.setFieldValue on fields, and tables are read only via the client api. Instead you have to use $eb.executeFunction() which allows you to do anything. To use this you have to create a Javascript function in a script on the server and and add it to the Client Callable Functions in Form Properties > Events. Then you can call this passing and returning any data you want. If you want to return multiple values, use a Javascript array or object.
0 x

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

#11

Postby xren » Fri Apr 25, 2014 2:48 pm

I can call $eb.executeFunction() to send back values.
However, how can I find the right row of the table in which I can set some of the column?

For example, I add a new row, then in first column, I use auto complete to get the value and also values for another two columns. and send these two values back to server, how sever find the right row to set the two columns?

And also, when I want to change the value of one of the rows in the table. How can the server know which row I am working on on the browser side?

Thank you.
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#12

Postby Jon » Fri Apr 25, 2014 3:46 pm

You need a column (or columns) displayed in the table that you can use to uniquely identify the row, then use jquery to get this unique value and pass it to the server. The server can then use findRow() to find the row. See this post http://forum.ebasetech.com/forum/viewtopic.php?t=532.
0 x

netpitss
Ebase User
Posts: 1
Joined: Wed Apr 30, 2014 6:34 pm
Location: 9 Evans Street
Contact:

#13

Postby netpitss » Wed Apr 30, 2014 9:37 pm

Jon wrote:That's right. You can only use $eb.setFieldValue on fields, and tables are read only via the client api. Instead you have to use $eb.executeFunction() which allows you to do anything. To use this you have to create a Javascript function in a script on the server and and add it to the Client Callable Functions in Form Properties > Events. Then you can call this passing and returning any data you want. If you want to return multiple values, use a Javascript array or object.

hello I'm a new here


How can the server know which row I am working on on the browser side?
0 x


Who is online

Users browsing this forum: No registered users and 8 guests