Topic: Options on form validations on modal form

rna014 pro asked 6 years ago


Hi, Just wanted to get an idea of validations (client side) for modal forms. Usually I would do this on the server side (am using spring boot) but wanted to see what are my options for doing so on the client side with MDB. R/

Jakub Strebeyko staff answered 6 years ago


Hi there R, To keep MDB lightweight, simple and open for customization, it provides components ready for implementing validation solutions by giving output, yet does not, in itself, bother with the logic behind, as it oftentimes is case-specific. That said, there are numerous ways to go about it, .validate() being one of the most widely used by our customers, it seems. With Best Regards, Kuba

rna014 pro commented 6 years ago

Thanks. What would be the recommended method of displaying validation error messages on MDB forms ? - Are there any examples I can review ?

Jakub Strebeyko staff commented 6 years ago

Well, usually passing in the messages for particular fields is done with data-error / data-success attributes. The method, though, may vary from plugin to plugin.

rna014 pro commented 6 years ago

ok I follow. I am trying out parsley as my validator and it exposes an attribute called "data-parsley-error-message" for the error message. What would a way of styling/positioning the output of this attribute the same way that MDB styles "data-error" ?

Jakub Strebeyko staff commented 6 years ago

I don't know Parsley, so can't advice, but if I were to be guessing - would suggest enriching it's initialization function with a script dynamically injecting data-parsley-error-message to particular element's data-error attribute. Worth to mention, that inputs' visual feedback is triggered using .validate, .valid and .invalid classes - that would be the way to tie it in with your validation method of choice. With Best Regards, Kuba


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: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags