Form Properties in Panels
GC Panels have now a new property called form. This property provides developers a way to define the name of the form that will contain all fields. The value must be a technical name, so camelcase is used and no space or special characters are allowed. This name can be used for global validation so that developers do not have to check all individual fields inside the panel.
As a simple example:
- Create a new view called: SampleFormView
- In the property panel, set the name of the associated form: sampleForm
- Add 2 fields (GC Input, last name and first name, and put 2 different validation rules (one is required, one has min/max values)
- Add a button (label=validate) and set the disabled property to: sampleForm.$invalid
Run the sample, the button is automatically disabled because nothing has been touch yet (the user did not go to any field). When the user goes to the last name field, and set a value, the button becomes enabled. Same when the first name is edited.
Considerations on repeatable panels
Repeatable panels are considered as individual panels and therefore, the sampleForm.$invalid will be applied ONLY on its respective panel instance.