# Structure ```html ``` # `pwc-dynamic-form` ## Render structure ```html
``` ## `formChanged` Event `formChanged: EventEmitter` Emitted when there is a change in the form. A change can be a field change or a form reset. ### Payload ```ts type: "change" | "reset"; fieldChangedEventPayload: FieldChangedEventPayload; formResetEvent: Event; formValues: { [key: string]: boolean | string | string[] }; formElement: HTMLPwcDynamicFormElement; ``` - `type`: type of the change. `change` if the event is raised due to a field change. `reset` if the event is raised due to a form reset. - `fieldChangedEventPayload`: (valid if type is `change`) payload of the `fieldChangedEvent` that caused this event to be raised. - `formResetEvent`: (valid if type is `reset`) the `reset` event that caused this event to be raised. - `formValues`: current form values (not the values before the event, but the new ones). - `formElement`: the `` element. ## `getFieldValues` Method `async getFieldValues(returnOnlyValuesForPwcSelects: boolean = false): Promise<{ [key: string]: boolean | string | string[] }>` ### Parameters - `returnOnlyValuesForPwcSelects`: Optional, defaults to false. If true, the values of `pwc-choices` fields will be object arrays containing choice objects, as passed to the items configuration. If false, they will be string arrays containing only values of each choice object. # `pwc-dynamic-form-content` ## Render structure ```html
Generated fields
``` ## `items` Prop `items: string | PwcDynamicForm.ContentItemConfig[]` This prop is our configuration for the form fields. ### Example ```js dynamicFormContent.items = [ { type: "select-single", name: "single-select-1", id: "single-select-1", label: "This is a label!", distinct: "value", choices: [ { value: "superstar", label: "Superstar" }, { value: "foo", label: "bar" } ] }, { type: "checkbox", name: "checkbox_1", id: "checkbox_1", label: "This is another label!" } ]; ``` ### `PwcDynamicForm.ContentItemConfig` type union `type ContentItemConfig = NativeInputConfig | PwcSelectConfig | PwcColorPickerConfig` This type is a union of the supported interfaces for the fields. #### `NativeInputConfig` interface ```ts export interface NativeInputConfig extends JSXBase.InputHTMLAttributes { label: string; } ``` This interface is used for native HTML input fields. - `label`: Translated into a `