Topic: How to validate select field

diconc priority asked 5 years ago


How to validate select field??

$('#fomulari').validate( { rules: { fieldSelect: { required:true } fieldSelect2:
function(error, element) { // Not execute never console.log("fieldSelect2", error, element); return true; } } });

this does not work.

and

jQuery.validator.setDefaults({
    debug: true,
    success: "valid"
});

jquery.validate.js:655 ​ has no name assigned


Sebastian Kaczmarek staff answered 5 years ago


Try to use native HTML5 form validation. See example: https://mdbootstrap.com/snippets/jquery/s-kaczmarek/326003


diconc priority commented 5 years ago

and if I want a validation through a function?


diconc priority answered 5 years ago


and if I want a validation through a function?


Sebastian Kaczmarek staff commented 5 years ago

Then you need to handle validation by yourself. Write a custom function and stop the form submission if something is not right.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB jQuery
  • MDB Version: 4.7.4
  • Device: windos
  • Browser: chrom
  • OS: windows
  • Provided sample code: No
  • Provided link: No