Comments (6)
There have been a number of validation logic updates over the past few days. Here is where we stand today:
#1 - To see the validation logic right away, the form should be loaded with an "edit" view. This is what gets loaded by default. So, by default, users should expect to see validation logic appear right away. (i.e. lots of red boxes on first render)
#2 - To hide the validation logic on first pass, the form should be loaded with a "create" view. You can do this by providing { "view": "VIEW_WEB_CREATE" } or creating your own view. Alternatively, you can hideInitValidationError on any of your fields individually.
#3 - If a field is in a valid state when clicked into, the field will remain in a valid state until the user clicks away (or blurs the field). Upon blur, the field's validation is recomputed and, if invalid, it will highlight with the red box. If the field was originally in an invalid state when clicked into, the field will revalidate on every keyUp() so that if the user enters a valid value, the validation state will clear up right away (i.e. red boxes go away).
#4 - When specifying a form, along with submit buttons, the submit button will be marked disabled until all of the properties of the form are valid. Furthermore, upon clicking the submit button, a recalculation of the form's validity is performed ahead of submitting the post.
Feedback and insights are appreciated. I think we're getting closer to having this right.
from alpaca.
Hello,
my use case is:
- I create the form with no data, since i'm using VIEW_WEB_EDIT_INLINE I have to set "hideInitValidationError": true on "all" fields
- Im "filling" the form with setDefault(); setValue(x); the data is correctly filled in, but NOT correctly validated, since validation is not triggered.
Step 2. is repeated multiple times...
.isValid(true) just returns the validation state of the form it thinks the form has .. .validate() does not validate again...
which is the main problem I have with validation now... (tried .renderValidationState() too without success)
What I want to say is that this is still confusing.
Of course there are 2 use cases:
- Where Data is available at the time of creation, this is how it works now
- Data is filled in later, this is what is handled by the HideInitValidationError flag on a per Field base
I think that this flag should be on a Form level and not on a field level
I think that this flag has nothing to do with the kind of view used to render the fields.
I think that one view for all fields could also be handled better, but this is a different issue (see #28 )
from alpaca.
I believe that in the case of wizards valdation should only occur for the currently visible fields. URI validation seems to break wizards where the URI fields are on anything other than the first step.
from alpaca.
The second item doesn't work when I have a submit button on the form. It shows validation message for all after I fill in the first field.
http://jsfiddle.net/35aKD/
If you remove the button property, it works as intended.
from alpaca.
how to put validation on height and width of the image while uploading using alpaca. Can someone please provide me small snippet for it
from alpaca.
re point 2 in @uzquiano's comment from 9 Feb 2013: { "view": "VIEW_WEB_CREATE" }
causes this error: The desired view: VIEW_WEB_CREATE could not be loaded. Please make sure it is loaded and not misspelled.
I tried { view: 'web-create' }
and { ui: 'web', type: 'create' }
, and while neither resulted in an error, neither prevented the error messages from displaying, either. Is there a new way for preventing validation messages from appearing when the form is first rendered?
The Validation API topic says:
An example of this is when the
hideInitValidationError
flag is set true in the options for the form.
So I tried $myForm.alpaca({ schema: schema, ui: 'web', type: 'create', options: { form: { hideInitValidationError: true } }})
, but that still didn't work. Help?
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.