Sunbird-RC / community

Repo to enable discussions, issue tracking & documentation for the Sunbird-RC projects
MIT License
12 stars 22 forks source link

Adding Nested & conditional fields support #693

Open chaitrali-r opened 1 year ago

chaitrali-r commented 1 year ago

Our advanced editor does not support Nested Fields

for example :

Textarea should include textfields,checkboxes,selects,radios, other text areas etc

This should also be reflected in the JSON schema as well

Renuka-S commented 1 year ago

https://json-schema.org/understanding-json-schema/reference/conditionals.html

suvarnakale commented 1 year ago

Conditional Fields Support will be added for : -

  1. Conditional field creation for text fields
  2. Conditional field creation for checkboxes

This is example for understanding how it will work: Image

suvarnakale commented 1 year ago

Development Approach :-

{ type: 'textfield', key: 'firstName', label: 'First Name', conditional: { show: true, // or false to hide the field when: 'age', // the field that triggers the condition eq: '18' // the value that triggers the condition } }

suvarnakale commented 1 year ago

How User can Implement Conditional and Nested fields :

  1. Like the form requirements and determine which fields should be conditionally shown or hidden.
  2. Determine the triggering conditions that determine the visibility of the conditional fields.
  3. Consider the values of other fields or user input as criteria for showing or hiding specific fields.
  1. Locate the field that needs conditional behavior in the form builder.
  2. Access the field's settings or properties to enable the conditional feature.
  3. Define the triggering condition, such as selecting the field that triggers the condition and specifying the required value for the condition to be met.

Image