Giter Club home page Giter Club logo

Comments (5)

ReactiveRaven avatar ReactiveRaven commented on August 20, 2024 1

Because it was only supposed to be for forms ;)

Unfortunately, you do need to 'set up' the field first (if you've copy-pasted step 2 from the installation in the docs, your fields should already be set up), but you can do something similar to what you've asked:

var $inputs = $("#my-text-field");
$inputs.jqBootstrapValidation(); // set up; ideally only called on each field once

// triggers the field(s) to show the error-state if something is wrong
$inputs.trigger("change.validation", {submitting: true});

If you want to do something with the error messages but not display them in help-blocks, you can also get them with collectErrors:

var errors = $("...").jqBootstrapValidation("collectErrors");

// {
//   "username": ["...", "..."],
//   "password": ["...", "..."]
// }

I'll mark this as an enhancement request too, it would make sense for it to be easier.

from jqbootstrapvalidation.

btantlinger avatar btantlinger commented on August 20, 2024

Awesome, thanks!

from jqbootstrapvalidation.

kenyee avatar kenyee commented on August 20, 2024

I'd like to second the enhancement request. E.g., I'm trying to use this w/ Meteor.js and forms aren't really "submitted". You catch the click event on the submit button, then do an ajax call to call a web method, then do a return false to prevent the click from doing the actual submit.
Would be nice if there were some way of saying "validate this form and display errors in help block now". There can also be multiple forms on the page at once, but they're hidden because it's a single page app framework (no browser refresh/reload at all).

from jqbootstrapvalidation.

tuxicon avatar tuxicon commented on August 20, 2024

Yes, this enhancement would be great to have!

from jqbootstrapvalidation.

skybondsor avatar skybondsor commented on August 20, 2024

+1 for adding this feature

from jqbootstrapvalidation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.