How to validate select field


Topic: How to validate select field

diconc pro premium priority asked 6 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 pro premium answered 6 years ago

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


diconc pro premium priority commented 6 years ago

and if I want a validation through a function?


diconc pro premium priority answered 6 years ago

and if I want a validation through a function?


Sebastian Kaczmarek staff pro premium commented 6 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
  • User: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.7.4
  • Device: windos
  • Browser: chrom
  • OS: windows
  • Provided sample code: No
  • Provided link: No