Getting Started with Client Side Javascript
Using client side javascript is the simplest way of integrating eSortcode into existing or new build websites.
To get you started, we suggest you download the following zip file:
| Client Side Javascript Downloads |
|
| .Zip File containing 5 html files (one for each of the eSortcode methods) |
download |
For the purpose of this example, we will be using the ValidateAccount.htm to demonstrate.
Once you have unzipped the files simply double-click the ValidateAccount.htm file to open it in a browser and press the 'Validate' button.
You should receive the following Error Message 'ERROR - Invalid eSortcode Account Details'.
This is because the eSortcode AccountName and GUID are not using your own Account Details.
If you have not already signed-up for an account click here
Sign-Up Now.
You will receive your Access Codes by email and you will receive 50 free credits.
When you have your Access Codes ready, open the ValidateAccount.htm file in 'Source View' by opening it in a common text editor like Notepad.
You will see 2 lines near the top that look like the lines below:
<input id=escAccountName type=hidden value=xxxxxxxx name=escAccountName> <input id=escGUID type=hidden value=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx name=escGUID> |
|
Replace the XXXXXXXX value with your eSortcode AccountName.
Replace the XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX value with your eSortcode GUID.
Save and Close the ValidateAccount.htm.
Now, reopen the ValidateAccount.htm file in a browser, enter an Account Number and Sorting Code and press the 'Validate' button.
If the Account Number and Sorting Code are valid you will receive a Validation Message 'VALID' otherwise you will receive a Validation Message 'INVALID: (Invalid Reason in here)'.
It's that simple, you now have access to a client-side Account Validator. Every time you press the 'Validate Account' button on the page your Credit Limit will be decremented by 1 Credit.
So, how does it work?
If you inspect the 'Source View' of the ValidateAccount.htm file in Notepad, you will see the following lines
SSL Note: If you are using Secure Socket layers replace the lines above with the following:
These are the Javascript files that do all the hard work by calling the ValidateAccount method of the eSortcode web service and returning the details to the ValidateAccount.htm file.
The eSortcodeBranchDetails.js file contains a procedure called 'ValidateThis' which is called when you press the 'Validate' button on the page. See below.
| <input id=escValidate onclick=javascript:ValidateThis(); type=button value="Validate" name=escValidate> |
|
The 'ValidateThis' procedure uses the Values from the 4 hidden fields shown below
<input id=escServiceName type=hidden value=ValidateAccount name=escServiceName> <input id=escAccountName type=hidden value=xxxxxxxx name=escAccountName> <input id=escGUID type=hidden value=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx name=escGUID> <input id=escIPAddress type=hidden name=escIPAddress> |
|
and the Values entered by the user for the Sorting Code and Account Number shown below
<tr> <td>Sortcode</td> <td><input name="escValidateSortcode" type="text" id="escValidateSortcode"></td> </tr> <tr> <td>Account Number</td> <td><input name="escValidateAccountNumber" type="text" id="escValidateAccountNumber"></td> </tr> |
|
to call the ValidateAccount method of the eSortcode web service and return the Validation Message, Is Error?, and Error Message values to the page, as shown below
<tr> <td>Validation Message</td> <td><input name="escValidateValidationMessage" type="text" id="escValidateValidationMessage"></td> </tr> <tr> <td>Is Error?</td> <td><input name="escValidateIsError" type="text" id="escValidateIsError"></td> </tr> <tr> <td>Error Message</td> <td><input name="escValidateErrorMessage" type="text" id="escValidateErrorMessage"></td> </tr> |
|
How do I integrate this into my site?
It should be very easy, the simplest way is to copy and paste the html between the <form></form> tags into your own page. You can then format and position the fields as you wish.
You
MUST include the references to the Javascript files in your page and the following input fields also
MUST be present:
NB: Do NOT change the name of any of the input or return fields as the Javascript file requires them to have specific names in order for it to workescServiceName
escAccountName
escGUID
escIPAddress
escValidateSortcode
escValidateAccountNumber
escValidate
You do not necessarily have to include all of the return fields:
escValidateValidationMessage
escValidateIsError
escValidateErrormessage
What about the other Methods of the eSortcode Web Service?
As mentioned earlier, the .zip download contains an html file for each of the Methods.
These .html files work in exactly the same way as the example above.
Remember to always include the references to the javascript files and all of the input fields (
do not rename these) and remember to enter your Access Codes. If you download your own local copies of the javascript files, we reccommend that you DO NOT make any changes to the eSortcodeProxy.js file as this will probably break the code.
For a full technical description of the eSortcode web service and the 5 methods click on the following link
Web Service Described.
If you have any questions feel free to contact us at the following link
Contact Us.