Make your plugin read-only

Making a plugin read-only ensures that users viewing or using a form clearly understand when they can and can't edit a value. Form controls may be in a read-only mode:

  • When submitting the form, if the field is disabled due to a rule.
  • When viewing completed forms in My Nintex.

For more information on disabling form controls with rules, see:

Jump to:

To enable a read-only mode for your plugin:

  1. Add the standardProperties.readOnly property to your plugin's getMetaConfig() function.
  2. This enables the Read only field in the plugin's configuration panel and rules.

  3. Add the implementation of read-only mode to your plugin's code.
  4. This defines how your plugin behaves in read-only mode.

Note: Form plugins does not provide a default behavior for read-only mode. If you do not define an implementation, your plugin will always seem editable, even in situations where the value can't be changed, such as viewing an already-submitted form.

For more information on plugin properties, see Plugin properties reference.

Add the standard field property

Add the standardProperties.readOnly property to enable the Read only field in the plugin's configuration pane:

  1. In the getMetaConfig() function, add a standardProperties object if one is not already defined.
  2. Inside the standardProperties object, add the property readOnly with a value of true.
static getMetaConfig(): Promise<NintexPlugin> | NintexPlugin {
    return {
      //...					
      standardProperties: {
        readOnly: true,
      },
    };
  }

Add the implementation

In your plugin's code, add the implementation to use the readOnly value provided by the configuration field.

Note: The following implementation uses the Lit framework. Your plugin's implementation may be different.

  1. Add a static property of readOnly to your plugin class. This maps to the standard property you created earlier.
  2. In the render() function, map the readOnly property to the textfield's disabled property.

When the readOnly property is updated in the plugin, the Lit framework will re-render the element using the new value.

export class ExampleTextfield extends LitElement {

  static properties = {
    readOnly: {}
  };
   
  //...
  
  render() {
    return html` <mwc-textfield
      id="textfield"
      .label="${this.label}"
      .helper="${this.description}"
      ?disabled="${this.readOnly}"
      @change="${() => this.onChange()}"
    ></mwc-textfield>`;
  }

}