Updating uischema

Hello Guys,

i’ve been using the master-details custom renderer and in that i am using uischema where I have few disabled properties for example.

type: "control",
scope: "#/properties/name",
label: "User name",
options : {
 "readonly" : true

With readonly true i am going ahead and disabling few form input’s and enabling them depending on above uischema options.readonly property.

this works fine for me when i have prefilled data from api. few fields are disabled that was my usecase but now on click of add Item on the list-panel of master-details I want to add a new Item. when I add a new item the uischema readonly options makes the new item disabled aswell inthe above scenario the name input is disabled for the newly added property aswell.

is there any way i can update uischema so that on click of add item. we can make the changes in the options.readonly false and make the the readonly false for only the newly added item

Hmm was able to achieve this with updatecorestate but it resets the form actually like all the prevs mat-list gets lost


was able to figure this out aswell but i want the old disabled fields to be disabled with updateCoreState it make all the prevs field which were disabled as enabled. is there any way i can use proppath or something to keep disabled for few fields and enabled for the newly added field

Figured this out with a flag thanks for checking : )

Hi @howdyAnkit,

With a custom master-detail renderer it should be rather straightforward to implement this behavior. It seems you are using a flag to indicate to the detail whether it’s a new object or alrady existing. For your use case this makes sense.

Thanks @sdirix

for replying can you please give any possible suggestions for asterisks not coming for the if-else validations. Since i have shared custom for most of the fields if i apply it for one which is already a required field it makes the asterisks coming up twice. I can make a custom component but they don’t look a better way to write one more custom component for just having asterisks. Is it possible to have it in the same shared custom component or any other possible fixes you can suggest?

There is no off-the-shelf required support for dynamically required fields in JSON Forms as this would require a tight integration with AJV or a separate evaluation step.

If you are already able to dynamically determine whether a field is required, couldn’t you then just NOT do it for fields which are already required?