Comments (7)
Hi,
You can just remove your custom error display logic and leave it to the ajax framework. https://octobercms.com/docs/ajax/extras
Btw, nice work!
from october-plugin-forms.
I was working on the suggestion by @jajacobs and works fine except por recaptcha validation.
Another idea in #35 is to pass a variable with the errors and add some custom javascript to mark the fields.
from october-plugin-forms.
@Zmove or @jajacobs, can you test the branch "inline-errors" ?
There is a variable in the response and javascript (a new js file is loaded) marks the errors fields ...
This is a demo code i was testing
<form data-request="{{ __SELF__ }}::onFormSubmit" data-request-validate data-request-flash>
{{ form_token() }}
<div id="{{ __SELF__ }}_forms_flash"></div>
<div class="form-group">
<label for="name">Name:</label>
<input type="text" id="name" name="name" class="form-control">
<div data-validate-for="name"></div>
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="text" id="email" name="email" class="form-control">
<div data-validate-for="email"></div>
</div>
<div class="form-group">
<label for="subject">Subject:</label>
<input type="text" id="subject" name="subject" class="form-control">
</div>
<div class="form-group">
<textarea id="comments" name="comments" rows="8" cols="80"></textarea>
</div>
<button id="simpleContactSubmitButton" type="submit" class="btn btn-default">Submit</button>
</form>
Thanks.-
from october-plugin-forms.
Why don't you put <span data-validate-for="g-recaptcha-response"></span>
under {% partial '@recaptcha' %} ?
<div class="form-group">
{% partial '@recaptcha' %}
<span data-validate-for="g-recaptcha-response"></span>
</div>
from october-plugin-forms.
The BETA branch has the inline functionality.
Anyone wants to test before release?
Thanks.-
from october-plugin-forms.
Inline errors was release in version 1.3.7
from october-plugin-forms.
Small question that refer to that issue that was merged with this one.
How do you add an "has-error" class to element that does not validate ?
I red the documentation, was able to display the error message in a div under the field, but I don't see how can I add an error class to the parent div of the field that don't validate.
Thanks for the help
EDIT : And I found a small issue with inline error message (they don't disappears if the form correctly validate a second time). To reproduct :
- Create a form with inline validation field (required for example)
- Submit the form with a required field empty, the inline validation message will be displayed
- Fill that required field, and submit the form again
- The inline error message will still appears whereas that form element is valid, I think it's a UI issue. The message should disappear.
from october-plugin-forms.
Related Issues (20)
- Plugin breaks in Build >1.0.469 HOT 5
- The specified file extension [js] is invalid HOT 2
- No buttons on component input fields HOT 5
- Translate fields name in backend
- Error 405 caused by field validation on live server
- Post AJAX not Working. HOT 1
- Bug HOT 2
- Image/file validation error HOT 2
- reCAPTCHA does not work HOT 1
- Error code 406 after validation
- proc_open() has been disabled for security reasons
- Sending the form with the October JavaScript API instead of Data attributes gives 406 Not Acceptable
- Expected response code 250 but got code 550 HOT 3
- File uploaded on the storage but not displayed in the record and email. HOT 1
- Laravel Validation HOT 13
- How to add auto response email field in generic forms? HOT 3
- DE translation mistake
- Using Magic Form on October CMS 3 HOT 2
- Currently Getting this Error when submitting my Ajax Upload Form HOT 1
- Magic Forms does not support October CMS v3 HOT 2
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 october-plugin-forms.