Autocomplete validation message getting lost?

Aug 15, 2013 at 4:06 PM

I have a an autocomplete box on a modal which returns an IQueryable of a domain entity (as opposed a type like string, int etc.) I have [Executed(Ajax.Disabled)] on the validate method and execution goes into this method and returns a string but the warning message never surfaces up to the UI i.e. it should be inserted after the text box.

I tried this whereby the autocomplete returned an IQueryable of type String and the message showed up. For some reason this doesn't work for domain entities?

I've replicated this in a barebones NOF solution.

Any ideas?

Aug 16, 2013 at 7:05 AM

I think that there is an issue with validation on auto-complete for a reference type. Auto-complete param fields are slightly strange from the framework's viewpoint because the type is, say, Foo - but the UI thinks it is a string - so the normal matching up doesn't work. (This explains why there isn't a problem if the param type is itself a string).

However, in many circumstances (not all) you can avoid this issueby ensuring that your AutoComplete method doesn't return any Foos that would be invalid for the action anyway - in other words filter them out using the Validate logic in advance. (Might not work if you want co-validation between multiple params, but I don't think that works with auto-complete anyway).

Aug 16, 2013 at 9:23 AM
Thanks Richard.

The validation was checking that the object being selected was not already part of a collection. I've removed the object from the IQueryable collection if it's already part of the collection.

Any idea if this issue will be fixed in the future?

Thanks again,
Aug 16, 2013 at 9:27 AM
I've posted a ticket to investigate this further at some point.
Aug 16, 2013 at 9:33 AM
Thanks Richard.