Basically, my model requires that an object is tied to a physical location. For this I'm pulling locations from an API via AJAX using keywords entered by a user in a text field, jQuery autocomplete is setup to set a hidden field to a unique ID when the user selects a valid location recommended to them.
This is all fine, assuming the user has JavaScript and clicks a location.
I need to implement a fallback, i.e. for whatever reason, if the form is submitted without the hidden field having a value, the form should use whatever is in the visible to query the API and present a select box for users to choose a value from.
I know roughly the code I need to add, but I'm lost as to where to bind it in. Any help appreciated.