Comments (4)
I've been thinking about this, but I'm not sure controlling the button is possible. theres a lot of different ways to submit a form ( [type=image], submit, javascript function, etc), and I can't guarantee the button both exists and will be wrapped in bootstrap.
Plus some forms disable the button just after submitting so you don't click twice accidentally, so it might not be enough of an indication that something went wrong.
Hows about adding the "error" class to the form element (bootstrap is smart enough that it doesn't wreck all the fields) and two javascript callbacks?
.jqBootstrapValidation(
{
submitFail: function ($form, errors) {
alert("invalid!")
},
submitSuccess: function ($form, errors) {
alert("OK, submitting");
}
}
);
That way you could set up your own "you have errors!" message in css, or a customised one with the actual errors via JS.
Not done yet, its still an idea. What do you think?
from jqbootstrapvalidation.
you could possibly scroll the browser up to that position of the first fail? The behaviour is already in use (of sorts) within bootstrap - scrollspy.
that way the button can exist as the developer had intended...
from jqbootstrapvalidation.
Sorry, I think this is outside of the scope I'd like to keep to.
from jqbootstrapvalidation.
as described above.
add submit success function:
submitError: function ($form, event, errors) {
/* ... */
goToByScrollByObj($("form div.control-group.error").first());
},
and add this function to your common javascript file.
function goToByScrollByObj(obj){
// Scroll
if (obj)
$('html,body').animate({
scrollTop: obj.offset().top},
'slow');
}
can probably be slightly improved but this should work.
from jqbootstrapvalidation.
Related Issues (20)
- Destroy undoes validations
- I use jquery ui to change the selectmenu,how can i to validate the selectmenu?
- Pattern
- Warning Don't Show
- jqBootstrapvalidation callback validation function not working after form validation
- filter does not affect "required" item
- Deprecated dependency "jQuery" in package.json
- jsBootstrapValidation it's not working with Bootstrap-select HOT 1
- The email [email protected] is correct? HOT 1
- Not working properly with jQuery > 1.7.2 HOT 2
- Remove wrong Comments
- Please add to JSDelivr HOT 1
- Not required Select menu tag have a red borde HOT 1
- How can you dynamically trigger validation of a single field? HOT 2
- Regex not working, input is never seen as valid
- i have two issues with the jqBootstrapValidation
- Validation field depending respect another 2 fields
- An email address with a TLD longer than four letters (like ".today") is marked invalid
- Dynamic Validate Problem
- How to make it work in modal
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jqbootstrapvalidation.