I have a jQuery autocomplete fild which gets existing data from my MVC action. I want to ensure that the data entered into the field DOES NOT already exist on the database.

I had thisworkig using .result and .change on the autocomplete to set the field to class = "input-validation-error". When I added xVal client validation this still works but xVal seems to clear the css class so now the field entry goes red briefly and then returns to clear background.

Rather than try to change xVal code I would rather get xVal client validation to display the field in an error state as for normal client data validation errors.

How would I do this? What code can I use in the autocomplete .result event to force the error state in xVal?

**Update:**
I tried the idea from Wyatt Barnett but as you can see from my comments its not what I want. Here is the code of what I have:

The field markup:

```
            <p>
                <%= Html.LocalisedLabel("ProjectId") %>
                <%= Html.TextBox("project.ProjectId") %>
                <%= Html.ValidationMessage("project.ProjectId", "*") %>
            </p>

```

The xVal markup:

```
       <%= Html.ClientSideValidation<ProjectBO>("project").UseValidationSummary("myValidationSummary") %>
             <%= Html.ClientSideValidation<ProjectBO>("project").AddRule("ProjectId", new RemoteRule(Url.Action("ValidateProjectIdCreate", "LookUp", new { projectId = Model.ProjectId})))%>

```

The javascript markup for autocomplete:

```
<script type="text/javascript">

    $(document).ready(function() {
        $('#project_ProjectId').autocomplete('<%= Url.Action("ProjectIdList", "LookUp") %>',
{
    delay: 10,
    minChars: 1,
    matchCase: 0,
    matchSubset: 1,
    autoFill: false,
    maxItemsToShow: 10,
    cacheLength: 10
}
);

        $('#project_ProjectId').result(function(item) {
            if (item) {
                //match
                $('#project_ProjectId').attr("class", "input-validation-error");
            }
            else {
                $('#project_ProjectId').removeAttr("class");
            }
        });
        $('#project_ProjectId').change(function() {
            $('#project_ProjectId').attr("class", "");
        });
    });
</script>

```

This script gives me the event to handle but what can I put in it?