I have a dropdown list in sharepoint form, it currently has a dropdownlist called Category and it is mandatory field. The field is lookup field from another team. A first item in the category is a select category. so when user does not select on an item from drop downlist i want to trigger a current out of the box error message "You can't leave this blank". However since the first item by default is select then it will not trigger the validation.
The following code i made it will trigger but it trigger the popup message. I would like to find out how to trigger like an error message similiar to mandatory textfied where you did not input the value
<script src="http://code.jquery.com/jquery-1.10.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("input[value='Save']").click(function(){
var strCategory = $("select[title='Category'] option:selected").text();
if(strCategory!="1"){
alert("Please select category")
return false;
}
});
});
</script>