crowdint/rails3-jquery-autocomplete — Issue #142: rails validation is clearing auto-complete form values
Author: darnjo
Created: 2012-02-15 02:20:19+00:00
State: open

I can't really share any of the code I'm working on here (under NDA), however I am having a problem with the auto-complete module that I thought I'd report before trying to track down what's going on myself. Maybe others have had the same issue as well...if one of the developers of this module wanted to contact me directly I could, perhaps, be a bit more specific. Or at least construct an example that more closely mirrors our code. For now, I'll start with a verbal description of the problem.

I've confirmed that my models, routes file, controllers, and views are set up the way the usage guidelines say they should be.

In my model, I also have some active record validations that prevent certain fields from being blank. In one of the views, for example, there are three auto-complete fields (which are auto-completing correctly) one of which cannot be blank via the validate keyword in the model.

Assume that the record passed validations and was successfully added to the database initially, and that now I'm editing this record. If I clear the required field value and try to submit the form, the validations are triggered and the missing field is identified correctly, however triggering the validation clears the value from every auto-complete enabled field on the page.

Another thing that's not happening correctly is that labels for auto-complete fields that don't pass validation are not being highlighted red, whereas normal non auto-complete fields are.