Home → API Manual → AJAX Selection Field → AJAX Selection Field Implementation Guide
3.2. AJAX Selection Field Implementation Guide
The first step in creating an AJAX Selection field is to create a script file on your web server. This script can be in any language, common selections are PHP, ASP, Perl, Python, or Ruby. An example file in PHP is linked at the bottom of this page.
This script will be called via HTTP GET with the following query parameters:
- xStatus
- xPersonAssignedTo
- xCategory
- sUserId
- sPhone
- sLastName
- sFirstName
- sEmail
- Custom## (note all custom fields will be included)
- callingField
Details on the meaning of these parameters can be found on the API field definition page.
One field to note is "callingField". This parameter holds the value of the AJAX Selection Field who's button was pushed. This value can be useful if you want to use the AJAX Selection Field as a search box.
Using the parameters sent to your script, you'll query your data source. Once you have the selection list you'd like to return you simply format it in the XML specified below and return that to the HTTP call.
AJAX Selection Field XML Specification
The XML your script should return is very simple. An empty result set is below:
<ajaxfield> <option> <value></value> <description></description> </option> </ajaxfield>
For each selection item you should have a pair of option tags. Each option tag has within it a set of value and description tags. The value holds the value which should be entered into the field when the option is selected. The description is the text shown to the staff member in the drop down select list. An example of the XML and the select list is produces is below:
<ajaxfield> <option> <value>#4878</value> <description>Support</description> </option>
<option> <value>#9978</value> <description>Emergency Support</description> </option> <option> <value>#9775</value> <description>Custom Development</description> </option>
<option> <value>#2111</value> <description>Training</description> </option> </ajaxfield>
This XML results in: