Skip to content

Sub-Form+

Description

Complex layout Sub-Form component for list (array) type form data, supporting nesting of complex layouts.

Use Case

  1. Improved organization
  2. Reduced redundancy
  3. Flexibility and customization
  4. Enhanced data accuracy
  5. Order forms
  6. Employee information forms
  7. Project management forms
  8. Survey forms
  9. Customizable product configuration
  10. Team member contributions
  11. Feedback aggregation
  12. Hierarchical data structures

Interactivity

  1. Show or hide sub-forms based on user choices in the main form.
  2. Dynamically reveal additional sub-forms as users complete previous ones.
  3. Implement branching logic based on sub-form data.
  4. Automatically populate sub-form fields based on data entered in the main form.
  5. Enable data manipulation within sub-forms.
  6. Use sub-forms as dynamic filters or search features.
  7. Integrate drag-and-drop functionality for reordering or prioritizing sub-forms.
  8. Implement collaborative editing for shared sub-forms.
  9. Use progressive disclosure to reveal sub-form content selectively.

API

Events

Name Description
onChange (element) The onChange event occurs when the value of a field is changed
onRowAdd (element) The onRowAdd event occurs when a row is added
onRowRemove (element) The onRowRemove event occurs when a row is removed
onPageChange (element) The onPageChange event occurs when a page is changed

Methods

Name Description Parameters
this.addClassName Add style class to a form item (fields: String|String[], className: String)
this.removeClassName Remove style class from a form item (fields: String|String[], className: String)
this.getComponent Returns a component whose id has been passed as a parameter (component_ID: String) : Object
this.hide Hides the field (fields: String|String[])
this.show Displays the field (fields: String \| String[])
this.disable Disable sub-form+ field from user interaction (fields: String|String[])
this.enable Enable sub-form+ field from user interaction (fields: String|String[])
this.setData Set the data in the field. The Value object should be of type { componentId: componentValue } (Value: Object)
this.getValues Gets the current values of all fields () : Object
this.getValue Get A Value From a component (fieldName: String)

Info

  1. The show() and hide() methods can also be used to control the visibility of a sub-form+ component in response to user input.
  2. Fields refers to a component ID or a list of component IDs. You can fetch the ID from the Component Attribute panel in the Page Builder.
  3. Before using this.show(fields), make sure the component is hidden. This can be done using this.hide(fields) or by enabling the Hidden checkbox in the Component Attribute panel.
  4. Before using this.enable(fields), make sure the component is disabled. This can be done using this.disable(fields) or by enabling the Disabled checkbox in the Component Attribute panel.

Steps to use the methods for the Page Builder components

  1. Go to Form Attribute Action Panel Setting (Mounted | refresh | click 'Add action').
  2. Write the method/code as shown in the Example below.
  3. Click on Save.
  4. On the main screen click on Save again.
  5. Click on Preview to see the code in action.

Example

  1. this.addClassName(fields, className)

    • Go to Form Attribute Style Sheets add the class
      .abc{ // abc is the class name
      background-color: red;
      }
      
    • Follow the steps mentioned above, under Steps to use the methods for the Page Builder components
    • this.addClassName('subform_e4cjz3nf', 'abc')
  2. this.removeClassName(fields, className)

    this.removeClassName('subform_e4cjz3nf', 'abc')
    

  3. this.hide(fields)

    var fields= ['subform_e4cjz3nf']
    this.hide(fields)
    

  4. this.show(fields)

    var fields= ['subform_e4cjz3nf']
    this.show(fields)
    

  5. this.disable(['fields'])

    this.disable(['subform_e4cjz3nf'])
    

  6. this.enable(['fields'])

    this.enable(['subform_e4cjz3nf'])
    

  7. this.getComponent('component_ID')

    var subname = this.getComponent('subform_e4cjz3nf');
    console.log('getComponent', subname);
    

  8. this.getValues()

    var data = this.getValues();
    console.log(data);
    

  9. this.getValue('fieldName')

    var subname = this.getValue('subform_e4cjz3nf');
    console.log('getValue', subname);
    

  10. this.setData(Value)

    this.setData({ subform_e4cjz3nf: [ { inputId: '1234', inputId2: 'value2' } ] })
    

Config

Name Description Icon
ID The sub-Form+ component's identifier
Name Name you wish to keep for the sub-form+
Label Width Width of the label associated with an input field. It determines the horizontal space occupied by the label text
Label Wrap If the label is longer than the allowed width the text will continue on another line
Hide Label Hides the label on the form
Text Prompt A description to aid the user when completing the field
Paging Enables pagination
Page Size Displays the number of entries per page
Show Control Displays control button
Default Value The default value which is filled in the field before the user changes it
Custom Class An HTML class attribute which allows further customisation See Form Attribute > Style Sheets
Attribute Action Enable Data Binding to connect the data to UI.
Enable Hidden action to hide the field.
Enable Disabled action to make the field unusable.
Enable Deletable to delete the row in the sub-form.
Enable Addible to add a row in the sub-form.

First time User?

If you are using the Page Builder components on the ConnexCS platform for the first time, we request you to use our guide on steps to use the Components.