@impactdk/ngx-cms-formbuilder
v1.0.0-beta.4
Published
A module to easily add forms from Umbraco in your Angular application
Downloads
4
Keywords
Readme
ngx-cms-formbuilder
This library is used to standardize form data sent from and to a CMS.
Supported CMS
| CMS | Support | | -------------- | ------- | | Umbraco Forms | Yes | | Sitecore Forms | Coming |
Usage
- Import the module into your AppModule and configure it to point towards your CMS
imports: [
CmsFormbuilderModule.forRoot(
'https://url-to-umbraco/rest/v1/forms', // URL to CMS API
'umbraco' // Type of CMS
)
];
- Import the service to fetch the form
export class AppComponent implements OnInit {
formData?: CmsForm;
constructor(private formService: CmsFormService, private cd: ChangeDetectorRef) {}
ngOnInit() {
this.formService.getFormById('GUID').subscribe(data => {
this.formData = data;
this.cd.markForCheck();
});
}
}
- Lastly use the imported component to display the form (or roll your own using the form data)
<div *ngIf="formData"><cms-form-page [formData]="formData" [pageId]="currentPageId"></cms-form-page></div>
Notes for Umbraco
Currently we support almost all fields in Umbraco Forms and most workflows.
| Field | Support | | --------------------- | --------------------------------------------- | | Short answer | Yes | | Long answer | Yes | | Date | Yes (make sure your template checks for null) | | Checkbox | Yes | | File upload | No | | Password | Yes | | Multiple choice | Yes | | Data Consent | Yes | | Dropdown | Yes | | Single choice | Yes | | Title and description | Yes | | Hidden | Yes | | Recaptcha | No | | Recaptcha2 | No |