Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC: How to make DropdownList field (with Chosen Plugin) Required

I have declared a parameter in my model as

[Required]
public int? param{get; set;}

and defined this on a dropdown list. Everything works fine and the data validation works, until I add the plugin, Chosen. When I add the plugin, there is no validation proior to submission. How can i keep the data validation when the plugin is applied on the Select element?

like image 545
jpo Avatar asked Mar 19 '13 12:03

jpo


Video Answer


1 Answers

As suggested here, I went to the chose js file and changed the this.form_field_jq.hide() to 'this.form_field_jq.css("position","absolute").css("left","-9999px")'

like image 198
jpo Avatar answered Nov 15 '22 11:11

jpo