Well, it seems that the answer is on jQuery docs: 'To force a user to select an option from a select box, provide an empty options like <option value="">Choose...</option>"
http://docs.jquery.com/Plugins/Validation/Methods/required On Mar 25, 5:40 pm, bdaniel7 <[email protected]> wrote: > Hello, > > I have the following situation: > > public class License > { > > [BelongsTo] > [ValidateNonEmpty("Please select a version.")] > public virtual ProductVersion Version { get { return version; } set > { version = value; } } > > } > > ProductVersion is a simple class, with Id and Name. > The versions must be chosen from a html select. > > Now, when I try to save, a license without a ProductVersion the jquery > validation is not generated, the save is attempted and I get a nasty > Object reference not set to an instance of an object. in > > Validator.NonEmptyValidator.IsValid(Object instance, Object > fieldValue) in c:\TeamCity\buildAgent\work\c01b5cadfdb79fbd\src > \Castle.Components.Validator\Validators\NonEmptyValidator.cs:35 > > I have added [ValidateRange(1, 1000)] and jquery validation is > generated, however, Castle Validator still reports that the version is > not set. > > Is there any solution to have validation, when using an html select? > > Thanks, > Dan -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.
