How to validate select field


Topic: How to validate select field

diconc pro asked a week 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 5 days ago

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


diconc pro commented 4 days ago

and if I want a validation through a function?


diconc pro answered 4 days ago

and if I want a validation through a function?


Sebastian Kaczmarek staff pro premium commented 2 days 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.
Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: jQuery
  • MDB Version: 4.7.4
  • Device: windos
  • Browser: chrom
  • OS: windows
  • Provided sample code: No
  • Provided link: No