Jquery...Migrating Test to Live

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

alexmcclune
Ebase User
Posts: 95
Joined: Wed Feb 27, 2013 5:16 pm

Jquery...Migrating Test to Live

#1

Postby alexmcclune » Wed Dec 10, 2014 2:57 pm

Hi,

I have migrated a form to our Live server, the first that uses jquery. The form:

-> works within our test environment
-> works when called locally from a designer
-> works when called using the hostname within our network.

-> does NOT work when called externally

Any thought as to why this doesn't work...I would guess a file path but under Form properties -> Web Resources -> Client Scripts I have six entries, three of which are externally hosted API's (JQUERY, JQUERYUI and GMAPS) with correct URLS.

I am guessing it is a path issue..caused by our web server but what am I missing?

Has anyone else encountered a problem like this - probably a classic web development mistake...but it's got me!
0 x

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

#2

Postby Jon » Wed Dec 10, 2014 5:13 pm

Can you test it externally? If yes, try running the form in Firefox with Firebug enabled, then look at the Net tab and check that all the external scripts and style sheets are loaded. You might also check the console for Javascript errors.

Regards
Jon
0 x

alexmcclune
Ebase User
Posts: 95
Joined: Wed Feb 27, 2013 5:16 pm

#3

Postby alexmcclune » Thu Dec 11, 2014 7:34 am

Hi,

Thanks - It is accessibly externally (only place it doesn't work) but still within testing as it does not fully function yet (jquery is one of two remaining problems - assuming the scripts work as expected).

I have opened up Firebug and taken a look in the Net tab as suggested, on moving onto the form page that include's the jquery (calendar and normal button) it looks like all the scripts load (see image):

http://s23.postimg.org/90m7n5auj/firebug_net_tab.jpg

I am going to migrate another form that uses jquery and see if it happens again (edit - the same issue occurs - works everywhere except externally).
Last edited by alexmcclune on Thu Dec 11, 2014 8:03 am, edited 2 times in total.
0 x

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

#4

Postby Jon » Thu Dec 11, 2014 7:59 am

Yes, that all looks fine. What actually goes wrong? Do you have any Javascript errors at the point of failure?
0 x

alexmcclune
Ebase User
Posts: 95
Joined: Wed Feb 27, 2013 5:16 pm

#5

Postby alexmcclune » Thu Dec 11, 2014 8:06 am

Jon wrote:Yes, that all looks fine. What actually goes wrong? Do you have any Javascript errors at the point of failure?
No Javascript errors as the functions are called via the HTML Element Properties -> Jquery code and ultimately nothing get's fired (the button does log the button click event but as it is jquery code nothing happens).

Quick query regarding the Net Tab but a lot of the scripts are greyed out - when I review the same tab on the same form within our network the scripts are not greyed out...?!!Googling it now.

Edit Firebug does report this:

The request was resolved directly from the cache, so we have no response from the server. See below for the cached response.

Google returns this from StackExchange http://stackoverflow.com/questions/6797 ... -net-panel but it may need translated for a beginner - I have tried the same form in both I.E and Firefox and the jquery doesn't work.
0 x

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

#6

Postby Jon » Thu Dec 11, 2014 8:20 am

Sprry, I meant Javascript errors in the browser, not the server - reproduce the problem with Firebug active, click the Console tab and scroll to the bottom.

All your scripts seem to have loaded OK (status 200 means OK + non-zero length). They may well have been resolved from the browser cache - you can always clear the cache in the browser if you want to, but it doesn't look to me that this is your problem.
0 x

alexmcclune
Ebase User
Posts: 95
Joined: Wed Feb 27, 2013 5:16 pm

#7

Postby alexmcclune » Thu Dec 11, 2014 8:29 am

Ah yes, we have some errors! On test we only have 1 error however on live we have 9 (including the same error as test) This screenshot details themhttp://s28.postimg.org/5euomd75p/js_errors.jpg

Ultimately the browser was blocking the content because the client script api URL's were using HTTP when our web server requires HTTPS. By changing these links to use // with no protocal it fixed the problem.
0 x

alexmcclune
Ebase User
Posts: 95
Joined: Wed Feb 27, 2013 5:16 pm

#8

Postby alexmcclune » Thu Dec 11, 2014 12:19 pm

Following on from this Jon,

We have a JS function for errors:

Code: Select all

function errorEbaseForm(){
	var error_url = 'https://url/ufs_EXTERNAL_FORMS/ufsmain?formid=ERRORS&FRM_ERRORCODE=';
	var error_code = 06; //Ebase Form Error...
	tables.EXTERNAL_ERRORS.insertRow();
	tables.EXTERNAL_ERRORS.CALL_ID.value = '';
	tables.EXTERNAL_ERRORS.FORM_NAME.value = system.variables.$FORMID.value;
	tables.EXTERNAL_ERRORS.CONTACT_ID.value = '';
	tables.EXTERNAL_ERRORS.ERROR_DESCRIPTION.value = 'Error Code: ' + error_code + ': Ebase Form Error ';
	tables.EXTERNAL_ERRORS.ERROR_CODE_ID.value = error_code;
	tables.EXTERNAL_ERRORS.updateTable();
	form.callUrl(error_url + error_code, null);
}
If this is called from the client side the final command "form.callUrl.." doesn't seem to be executed. The page just "sticks" but I know the function is executed from the log's and the DB entry.

Any thoughts as to why the final command isn't fired?
0 x

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

#9

Postby Jon » Thu Dec 11, 2014 12:40 pm

I think this may be a bug i.e. call url doesn't work when called from the client api. We have an outstanding bug saying that upload similarly doesn't work and I suspect call url is the same problem.

I can only suggest you get the client to invoke the url instead of the server, after it's done the client call.

Regards
Jon
0 x

alexmcclune
Ebase User
Posts: 95
Joined: Wed Feb 27, 2013 5:16 pm

#10

Postby alexmcclune » Thu Dec 11, 2014 2:23 pm

Jon wrote:I think this may be a bug i.e. call url doesn't work when called from the client api. We have an outstanding bug saying that upload similarly doesn't work and I suspect call url is the same problem.

I can only suggest you get the client to invoke the url instead of the server, after it's done the client call.

Regards
Jon
Thanks Jon, can you advise?

I am using the "executeFunction" and I understand that it can handle a failureCallBack if I write a client side function to handle the error url...bit stuck as to the code...Google suggest's a lot but I cannot see how to implement them within Ebase. Along the lines (this doesn't work - every occurance take's me to google..even successful submits):

Code: Select all

$eb.executeFunction("epdSubmitSync",null,true,true,window.location="http://www.google.com");
I have also tried using form.goToURL rather than form.callUrl within the server side script and that didn't work either.
0 x

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

#11

Postby Jon » Thu Dec 11, 2014 3:48 pm

It could work like this: the client calls the server using the client api and specifies an error handling function which is called if the server crashes. The server function will detect failures using a try/catch mechanism - I'm guessing you are already doing this as you have created an errorEbaseForm() function to handle errors. After logging the error, the server function will abort - this is done deliberately so that the client's error handling function is executed.

Client code would look like this (error handling function is the fifth parameter):

Code: Select all

$eb.executeFunction("epdSubmitSync",null,true,true, function(reason) {window.location="http://www.google.com";});
Server function would look something like this:

Code: Select all

function epdSubmitSync()
{
   try 
   { 
      ...
   }
   catch (e)
   {
     errorEbaseForm();     //log the error
     form.abort(e);        //abort the function execution
   }
}
Note: I found this only worked if there was no on error event specified for the form. If you have an on error event, it will intercept the form.abort() and won't return to the client.

Hope this makes sense.
Jon
0 x

alexmcclune
Ebase User
Posts: 95
Joined: Wed Feb 27, 2013 5:16 pm

#12

Postby alexmcclune » Fri Dec 12, 2014 8:21 am

Thanks Jon - that's great...very close to my final solution.

As I have already built a fair bit of error logging I was only actually missing the following command from the various error function calls:

Code: Select all

form.abort(e)
Then the callback function correctly sends the user to the error form.
0 x


Who is online

Users browsing this forum: No registered users and 15 guests