angular-schema-form
angular-schema-form copied to clipboard
Add UI Policies
Enhancement
As a user/developer, when I change a field value I should be able to make other fields become readonly, required, defaulted or hidden based on conditions that can be evaluated after certain change parameters are met.
This includes multiple fields to watch for change and the option to apply updates to multiple fields as well.
Related issues
#597
@json-schema-form/angular-schema-form-lead
There is a function to redraw the schema form.
// We also listen to the event schemaFormRedraw so you can manually trigger a change if.
// part of the form or schema is chnaged without it being a new instance.
scope.$on('schemaFormRedraw', function() {
var schema = scope.schema;
var form = scope.initialForm ? angular.copy(scope.initialForm) : ['*'];
if (schema) {
render(schema, form);
}
});
You can check your model and edit your actual form instance then broadcast.
var model = myModel;
angular.forEach($scope.form, function (detail) {
if(detail.key[0] == 'name' && model.changed){
detail.readonly = true;
}
});
$scope.$broadcast('schemaFormRedraw');
This solve your problem?
@camilobaezcamba this ticket is for planning a feature I plan to add to the framework in future and is more of a reminder for myself :)