Comments (11)
Hey,
How did you implement the submit button?
Did you add your own submit handler?
Yong
from alpaca.
from alpaca.
i saw also in your examples in the website there is the same problem ....
the first click call the validation , the second one the submission ...
but if you click in the submit button i should validate and submit on the fly ...
from alpaca.
The root cause of the issue is that when Alpaca did the validation and found out the field was valid, it removed the error message as well as the red box around the field. This made the whole field shift upwards. The validation is triggered on the blur event which is fired before the click event.
That is why it wouldn't consider the click was on the submit button since the button was moved upwards. If the submit doesn't get the click event, the custom submit handler will never get invoked.
Actually if you click on the top edge of the submit button, you may just need one click.
There are a few ways to fix it. One easy way is to make the button bar at the fix location. Or we can add delay to the blur handler. But none of them is a solid solution.
I will do more research and find a better fix.
from alpaca.
Maybe the reason is that the click event is async and so it can occur before then the validation event related with another event (on focus maybe???). I think you might force to call validation subroutine also in on submit .... You can add a variable for keeking the information of the last valitation for not calculate twice the validation.
from alpaca.
Else maybe there is also this mor elegant solution : http://stackoverflow.com/questions/7721689/how-to-set-the-order-or-priority-of-functions-call-in-jquery-or-javascript ... but i never used it. :) i hope to have been useful
from alpaca.
another interesting help: see this page
http://stackoverflow.com/questions/7917391/how-to-bind-simultaneous-events-with-jquery
from alpaca.
How about this solution
http://www.alpacajs.org/examples/forms/login/localized-login-form.html
from alpaca.
Ok thanks this could be a work around.
Anyway i advice in the future to refactor the framework for handling directly this problem: by using 2 click instead 1 could create strange situation in complex form where a developer use custom logic.
from alpaca.
I just checked in the patch to the framework so that you won't need to add custom code in the callback.
http://www.alpacajs.org/examples/forms/login/localized-login-form.html
The patch is in Form.js
$(v).mousedown(function() {
var _this = $(this);
_this.attr("button-pushed","true");
setTimeout(function() {
if (_this.attr("button-pushed") && _this.attr("button-pushed") == "true" ) {
_this.click();
}
}, 150);
});
$(v).click(function() {
$(this).removeAttr("button-pushed");
});
from alpaca.
After some trial and error, I found that I was using only oninvalid on some inputs and oninput event on others.
I don't know the actual issue, but I made it work by adding both oninvalid and oninput events, on each input.
Example:
fullname.addEventListener("invalid", function() { if (fullname.validity.valueMissing) { fullname.setCustomValidity("custom required msg"); } else { fullname.setCustomValidity(""); } });
fullname.addEventListener("input", function() { fullname.setCustomValidity(""); });
I wish it does help someone
from alpaca.
Related Issues (20)
- Layout/template for ArrayField items?
- format: uri does not accept an IP address HOT 1
- Multiselect order
- Add new item in Array object with multiple selected
- Plans on proceeding with broken TAG-field?
- [Ask] change helper text color
- [Ask] Accessing options of a field from another field
- How do I trigger the per-field validation chain when ANY field changes on the form?
- "too much recursion" with jQuery 3.4 using enum
- textarea data not being set properly
- Missing null checkes
- When Creating A Form Builder, How do I make the checkbox multiple select to be true as default? HOT 1
- Conditional Dependency failing
- Field is excluded in the Alpaca.getValue() when dependent on hidden field
- Unable to set uploaded images in postRender
- Repo Future? HOT 3
- After load form and the first running function in the 'events > change' in the select field the validation stops work
- Is this a bug with the "valid" and "invalid" callbacks inside a View?
- Alpaca Gitana
- $('MyForm').alpaca() causes "Maximum call stack size exceeded" for specific Select Field
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 alpaca.