This project is not covered by Drupal’s security advisory policy.
This module allows site-builders to import a form that is exported from the Watson Customer Engagement (WCE) WYSIWYG into a Drupal 8 site and parse it into a Webform.
Description:
The Watson Form Parser Module (form module) was created to streamline the process of exporting a form from the Watson WYSIWYG and placing it in a Drupal site.
The previous method used to place a form from Watson into Drupal involved getting the raw HTML code, removing extraneous code ( <table><td><tr> and inline style attributes), changing the layout, and applying custom classes and attributes before pasting the new, clean HTML into a full HTML form. With this module, a site builder will be able to take the code that is provided from the Watson WYSIWYG and convert it into a Drupal Webform using the Webform module.
Requirements:
The form module currently depends on the Webform 8.x-5.2 and Webform UI 8.x-5.2 modules and previous versions (pre 8.x-5.x) will not work.
Limitations:
So far the form input types that have been tested and work with the form module are:
- Text input
- Select List
- Checkbox
- Checkbox group
- Radio buttons
- Hidden
These are specific to the code that Watson spits out of the WYSIWYG form builder and this should not be used to parse HTML forms that don't match the format provided by Watson. Elements can be edited before entering them into the form module, but they need to follow the same convention as Watson HTML.
When a form is parsed, it is converted into a 2 column layout based on the number of input elements in the form. This can be changed in the Webform UI.
This will only work on Watson forms, and a limited number of input types. I'm hoping that down the line we can add more types to be parsed, but these are what are needed now.
This sets all fields to required by default.
Whatever the field label is in the source HTML is what it will be in the Webform. For example, it will not convert firstName to First Name.
Updates are currently destructive to layout changes, meaning that if new raw HTML is put into the parser with fields in a different order, then the fields will take the order from the HTML in the layout.
The layout doesn't take field types into consideration.
As of now, no fieldgroups are created for checkboxes or radios or anything. Also on my @TODO list.
Future hopes:
- Add more field types.
- Make it non-destructive to layouts.
- Add more layouts.
- Better mapping for fieldgroups that may go together like addresses and dates, assuming there's a need.
Pre-Usage Setup:
The goal was to make the form module as user-friendly as possible. In order to achieve this, the form was built with the least required user interaction possible.
Instructions
- Create the form using the Watson form builder in your Watson instance. This should provide some raw HTML that begins with
<form>and ends with</form>. - Copy the entire snippet from the exported HTML.
- Go to the Drupal site and create a new Watson form admin/structure/watson_form/add. See here.
- Paste the HTML in the Base Form HTML field.
- Do this first so you don't lose it from your clipboard.
- Create a name for the Watson form entity. This will also become the name of the Webform.
- Create an administrative description that will only be visible on the back end of the CMS to help describe the form. Place this into the Webform Admin Description field.
- Use the Webform Description field to place any formatted text that should be rendered above the form. This is a great place for a title, description, instructions, etc.
- Do not fill out the Webform field.
- Once complete, save the Watson Form. If there are no errors, the form will be parsed into a Webform and you will be directed to a new Webform.
Project information
Seeking new maintainer
The current maintainers are looking for new people to take ownership.- Project categories: Integrations
- Ecosystem: Webform
- Created by dorficus on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
