Comments (7)
@lhmiranda thanks for your input! There is always the option to just change the validations template to one of your liking. It's very simple and explained in the Readme. I'm not very keen about changing the default behavior to be honest, as it might break the existing functionality for some people.
from ng-fab-form.
Could you elaborate? Do you want to display validation messages, if there is no required-attr. set?
from ng-fab-form.
e.g. For phone field I have added validation max-length to be 15, but it is not required field.
If someone adds data to this phone field it must not exceed the 15 chars.
So I will not add "required" attribute to the input.
In this scenario validation message does not get displayed for invalid inputs.
from ng-fab-form.
Thanks for the explanation. I think the default behaviour is still preferable, as usually a field is required, when it should be validated and vice versa and I could imagine it would be very annoying to have validation messages shown, where you don't want them and it is easier to conditionally add ng-required than to conditionally disable validations for a field.
You could use ng-required in the case you described above, e.g.:
<input ng-required="ngModel.length > 0">
I'm not 100% sure though. Maybe I'm wrong. If other people share your irritation I'm open to changing that.
from ng-fab-form.
Thanks for your reply., My opinion is that, validations are methods to allow "only valid" data to form.
I think that this case holds for both required and non-required fields.
I have already implemented workaround in my validation template to show messages even for non-required && invalid fields.
Lets see if anybody other than me has same problem which I think is the likely case.
:)
from ng-fab-form.
I'm closing this for now, but feel free to reopen. Thanks for your input again!
from ng-fab-form.
Well, I also disagree that only required fields should show validation messages. In my specific case, I have a validation that checks if the user's birthdate is either empty or a valid date. It isn't required but if the user fills it, it should be validated and I don't want to rely on browser's specifics.
Let me ask a question tho, what problems would arise if I removed the ng-show="attrs.required===''|| attrs.required"
attribute? I've tested and everything seems right. Is there any scenario that this could cause a problem?
from ng-fab-form.
Related Issues (20)
- Asterisk for required label and bootstrap 3 HOT 5
- Section 508 HOT 1
- npm version for webpack HOT 4
- ngFabForm fails to properly initialize when navigating to a futureState HOT 7
- Angular 1.4 compatibility HOT 7
- Add a way to copy the error classes to parent element. HOT 4
- outdated validation-errors-template in demo breaks some style behaviors HOT 2
- Input[number] ng-pattern validation overrides the ng-maxlength validation HOT 6
- on reset input fields still remain dirty HOT 2
- Fire validation mechanism for single input HOT 3
- ng-fab-forms with angular ui-select HOT 3
- Chrome browser crashes when opening a page that contains a <form> HOT 7
- Execute function before focusing on first erroneous input HOT 2
- validate field without required attribute HOT 2
- Validation trigger on ng-click instead of submit HOT 13
- Feature request - required and ng-pattern validation for ui-select HOT 2
- ng Fab Form not behaving nicely with material design (angular 1.5.8) tags. HOT 1
- Animations not performing ? HOT 1
- npm WARN deprecated [email protected]: Use uuid module instead HOT 1
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 ng-fab-form.