I'm using Alpaca forms to display some information :
$("#object_details").alpaca({
"schema": map[obj_type],
"data": JSON.stringify(json_data["content"]),
"options": {
"label": "some label"
}
})
So I have some JSON Schema defined :
json_schema = {
"title": "Host",
"en_description": "Host object",
"type": "object",
"properties": {
"addr": {
"en_description": "IP addresses",
"title":"Host addresses",
"type": "object",
"properties": {
"ipv4": {
"en_description": "Host IPv4 address",
"title":"IPv4 address",
"type": "string",
"format": "ipv4",
"readonly":True
},
"ipv6" : {
"type": "string"
}
}
}
As you can see I got some field on ReadOnly, and some others on edit mode. I want to make a modified-field to become readonly. For example, here, if I modify the ipv6 field, once I send my forms, the ipv6 field will become readonly.
Is that even possible ?
Yes you can do this by setting the read-only option to true after you submit the form like the following:
field.options.readonly = true;
field.refresh();
Here's a working fiddle for this.I hope this is what you're looking for, tell me if you need something else. I'll be glad to help you out.