Support immutable fields

Support immutable fields

sliekenssliekens Posts: 97Questions: 17Answers: 2
edited June 2017 in Editor

A common business rule in my application is to reject edits to fields after the row is created.
Currently I handle this inside a preOpen handler by imperatively enabling fields when the form type is "create" and otherwise disabling them.

// in preOpen event handler
if (action === "create") {
  editor.field("user_name").enable();
} else {
  editor.field("user_name").disable();
}

I prefer a declarative programming style so I would like to request a new field option for this: fields.immutable.

var editor = new $.fn.Editor( {
    // ...
    fields: [
        {
            label: "User name:",
            name: "user_name",
            immutable: true
        },
        // ...
    ]
} );
This discussion has been closed.