XRX/Detecting Duplicates

Motivation
You want to detect duplicate terms as the user types within a field of a form.

Method
We will create a form that sends a request to the server each time a letter is typed into a field. The form will call a ReST web service and pass the current term as a parameter.

Sample XQuery
The following query can be used on the server to detect duplicates.

This query takes a single parameter and returns a true or false element.

$BASENAME/xqueries/term-exists.xq?term-name=Product

If the term exists in the database it will return the following:

XForms Application
   Check Term  Term:    Check for Dups  Now we have a simple XForms that calls a web service and returns a true/false record. Our next step is to make this test occur in the background as the user types and display a warning message as a duplicate has been detected.

Adding Character-by-Character Testing
Now we have two tasks. We need to fire off the event to the server as the user types and we need to bring the information back without interrupting the user.

First we want to add an event to the input field that sends a message each time a character is typed into the input field:

Back: FAQ Manager • Next: Data Element Editor