formBuilder icon indicating copy to clipboard operation
formBuilder copied to clipboard

[Bug] Missing header subtype when header and subtype are disabled

Open IrvanFza opened this issue 3 years ago • 0 comments

Description:

When I disable the header field and the subtype attribute, the header subtype was not properly rendered and not included in the data, while other fields work perfectly fine. I make the header as the default field, not removable, and not copy-able. Here is the working code:

jQuery(function ($) {
  "use strict";

  let fbOptions = {
    disabledAttrs: ['subtype'],
    disableFields: ['header', 'paragraph'],
    disabledFieldButtons: {
      header: ['remove', 'copy'],
      paragraph: ['remove', 'copy']
    },
    defaultFields: [{
      label: "Change This Title",
      type: "header",
      subtype: "h4"
    },{
      label: "Change this description",
      type: "paragraph"
    }],
    persistDefaultFields: true,
    fieldRemoveWarn: true,
    onSave: function(evt, formData) {
      // I should see a header with h4 subtype here
      console.log(formData);
    },
  };

  $('#form-builder').formBuilder(fbOptions);
});

I also already provide a pen here: https://codepen.io/IrvanFza/pen/QWvMvqw

Environment Details:

  • formBuilder Version: 3.7.3
  • Browser: Chrome Version 91.0.4472.164 (arm64)
  • OS: macOs Big Sur Version 11.4

Expected Behavior

  • Default header is rendered with the subtype
  • header subtype is included in the data

Actual Behavior

  • Default header is not rendered with the subtype
  • header subtype is not included in the data

Steps to Reproduce

  • Create default field with header and subtype
  • Disable the header and subtype

IrvanFza avatar Jul 20 '21 14:07 IrvanFza