Saving field values in yaml with disable or hide attribute

The text field in yaml has a trigger that assigns disable to it from the checkbox. And the same field has a default value that I need to save regardless of the checkbox (a record has been created and the value should already be there). How? The entire record is json, so assigning default to the database is not possible.

          h3_1:
            span: full
            type: text
            default: 'tralala'
            trigger:
              action: disable
              field: h3_edit_on
              condition: unchecked

I think, You can use beforeSave in model to check if h3_1 key is present in post variables if it isn’t save the default value here.

h3_1 key can be empty, h3_edit_on checkbox enables the edit of this field, including the removal of the default value

h3_1 key itself will be missing in post data if field is disabled. Check if isset('h3_1') and update value.

2 Likes

Checking work in twig

    {% if item.h3_1 is null %}
      {{default}}
    {% end%}

Thank you.