Comments (14)
@Anthropic Will check this out. Just saw some sf-new-array and the old one got deprecated. So let me check that.
from angular-schema-form.
The problem is in the scema-validate directive (schema-validate.js, row 26), it assumes any required is handled by ng-required, which of course is not the case with arrays. And therefore it never validates against the schema, it should probably check for presence of ng-required... marking it as a bug.
from angular-schema-form.
@davidlgj do you think this change goes in the right direction (please ignore the un-minified dist file I added) ?
Was just quick try. Still doesn't solve the problem, when the checkboxes never where changed. But if you select one and then deselect all it will show you an error.
from angular-schema-form.
Actually I don't know... I'm not sure what you're trying to do? Why a $watch?
I was thinking more along the lines of dropping the "ng-required" attribute on all inputs and instead re-implement it with the validation tv4js does. That would mean a slight difference in handling in modern browsers, but it would fix support for IE8 (which I need to fix next month or so anyway). tv4js does check for required so basically just removing this statement:
//required is handled by ng-required
if (angular.isUndefined(viewValue)) {
return undefined;
}
Should let it through. But alas if it was that easy, in draft 4 of json schema they moved the "required" attribute from the property to a list on the object (as you have written). In angular schema form we put it
on the form (so it can be overridden and so we can support both v3 and v4), so we have check the form, not the schema. This means that to validate we need to wrap our array value in an object and do the same with the schema snippet.
Something along this line: (warning, untested)
var result;
if (required === true) {
result = tv4.validateResult({ wrapped: value },{
type: "object",
required: ['wrapped'],
properties: { wrapped: schema}
});
} else {
result = tv4.validateResult(value,schema);
}
The second problem here is that we don't have the form definition (or rather info if the form is required or not), probably easiest to check an attribute for that. Maybe call it sf-schema-required :-) So basically replace ng-required with sf-schema-required.
As you might have noticed I haven't fixed any issues that have come the last two weeks, It's because I'm on vacation and don't have that much computer time, but basically from middle of august things should be back to normal and I'd have more time :-)
from angular-schema-form.
Hey, thx David. Enjoy your holiday and don't spent because of me more time in front of the computer!
The problem is, that the parser never gets called for array fields. I think because the model of the array (
from angular-schema-form.
Hi @torstenrudolf,
I ended dropping reliance on ng-required and made it so tv4js validates required as well, it's in release 0.7.0. This plus validating on certain event now works with arrays. It's not that nice yet though, it does validate require and maxItems etc, but it doesn't stop you from pressing "Add" button, IMHO it should be disabled when you can't add more items.
from angular-schema-form.
Thx @davidlgj
from angular-schema-form.
I think this bug is not quite resolved, unfortunately.
You are right, it is working for tabarrays, but for the example above, with checkboxes, I can't see it working on the example page.
from angular-schema-form.
Is this resolved ? I am having this issue with latest stable.
from angular-schema-form.
@jimmykane it looks like it should be, have you tried with the alpha?
Actually it appears to work in the demo site, can you try again using the bootstrap decorator file from the bootstrap decorator repo rather than the bundled one if you are using bower?
from angular-schema-form.
@Anthropic Is alpha stable enough? We have our own decorators unfortunately and somehow I caught right now in the middle.
Might the bootstrap decorators (repo link?) work or should I test also against alpha?
from angular-schema-form.
angular-schema-form-bootstrap repo is in this org, if you use the decorator file from there it is more recent than the bundled one in bower. Are you setting validate on render? If not it would only validate on submit.
from angular-schema-form.
AS far as I checked the following:
{
"type": "object",
"required": ["editors_used"],
"properties": {
"editors_used": {
"type": "array",
"title": "What editors do you use?",
"minItems": 1,
"items": {
"type": "string",
"enum": [
"vim", "emacs", "sublime", "kate"
]
},
"additionalItems": false
}
}
}
Will validatate for the whole form but not for the checkboxes. The form state is invalid but only after a change is triggered the checkboxes get the correct validity state
from angular-schema-form.
Here is the plnkr as well https://plnkr.co/edit/fjSB0WgkJ46GuQZW6sz8?p=preview
The problem is still there but not on alpha
Tested -> Alpha is ok
Tested -> Old .8 with new decorators not OK.
from angular-schema-form.
Related Issues (20)
- Conditionals for arrays inside arrays
- Maintenance status of the library
- How to show default value in type select titleMAP
- Conditional required rule HOT 1
- Add-on ngModel builder seems to not work at all HOT 3
- Add-on with ng-model="$$value$$" not binding properly in an array HOT 2
- condition is not supported for IE HOT 7
- Required validation messages
- version(0.8.14) regression in conditional array validation HOT 3
- Schema form for Android HOT 1
- Array type schemas do not render HOT 4
- Dynamic Type's from Model
- Form Update
- Form generation for part of schema HOT 1
- npm angular-schema-form uses 0.8.13 rather than 0.8.14 HOT 1
- Broadcast schemaform.error.* broken
- errors in bootstrap templates
- files endpoint option
- checkbox not styled with bootstrap
- Custom layout for specific property/ies
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 angular-schema-form.