You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hook in an onChange on the button (or checkbox?) and re-render the form by changing the schema, removing or adding the "readonly" attribute. Currently it's a simple $watch so either the form object or the schema needs to be a different object instance for it to trigger a re-render.
You can use angular.copy to prepare two versions of the schema, one which is readonly and one which is not.
...or you can use the type conditional. Make two conditional with expressions that listen to the same value but one that triggers when its true and one that triggers when its false. So one of them is always visible. You can then set one of them to be disabled and one to not be disabled with the form option readonly.
I'm closing this issue since it's neither a bug nor and enhancement request. Try stackoverflow if you have more problems, tag it with angular-schema-form and we will see it :-)
The second method of using two conditionals worked for me, but when I switched to alpha3 it stopped working. I am using the conditionals inside an array.
Hello. Please, help.
I have in app.js:
$scope.schema = {
...
"readonly":true
};
$scope.form = [
"nick",
"email",
{
"key": "message",
"type": "textarea",
"placeholder": "Problem description",
},
{
"type": "submit",
"style": "btn-info",
"title": "OK"
}
];
$scope.model = {};
and in index.html:
<form sf-schema="schema" sf-form="form" sf-model="model"
<div class="row">
<div class="col-md-6">
<div sf-insert-field="['nick']"></div>
</div>
<div class="col-md-6">
<div sf-insert-field="['email']"></div>
</div>
</div>
</form>
I need button which can toggle form fields state (enable/disable for editing). How to implement it? Thanks, for any help.
The text was updated successfully, but these errors were encountered: