Webforms¶
Webforms are the FedMS solution for any structured data capture: registrations, feedback surveys, pre-event questionnaires, post-event evaluations, internal forms.
FedMS uses the standard Drupal Webform module plus two important extensions:
- Webform Content Creator — syncs webform submissions back to entity fields (e.g. a profile-update form syncs to the user entity).
- Webform paragraph — embeds a webform as a paragraph inside events/sessions.
Where to author webforms¶
1 | |
You need the appropriate webform admin permissions. By default, Content Managers have them.
Creating a webform¶
Standard Drupal Webform UI:
- Add webform → label, machine name.
- Drag in fields from the element library: text, email, select, radios, checkboxes, date, signature, file upload, sections, conditionals…
- Configure validation, default values, conditional visibility per element.
- Configure submission handlers (email, save, third-party integrations).
- Configure confirmation: redirect vs. reload vs. inline message.
The "stay in context" rule¶
When a webform is embedded inside another page (e.g. a book page or
an event content entity), set the Confirmation type to reload,
not redirect. Otherwise the submission takes the user out of the
parent page.
Embedding a webform in an event or session¶
Use the webform paragraph type:
- Edit the event/session content entity.
- Add a
webformparagraph to the description. - Pick the webform.
- Save.
The webform now renders in the event/session page, with its submission scoped to the surrounding context.
Syncing submissions to entities¶
The Webform Content Creator module syncs webform submissions back to a target entity. The classic use case: a profile-update webform that writes to the user entity.
Configuration¶
/admin/config/webform_content_creator
- Add configuration — label, source webform, target entity type, target bundle.
- Pick Synchronize the creation/edition of content based on unique content field.
- Enter the synchronization field machine name — the field name
in the entity that uniquely identifies the row to sync to
(e.g.
uidfor users,idfor content entities). - Save the configuration.
- Manage fields — for each entity field you want to sync, pick the matching webform element. Don't forget the ID field itself!
The "sync to current user" recipe¶
For a webform that updates the current user's profile:
- Add a hidden element with key
uidand default value[current-user:uid]. Drupal will warn thatuidis reserved — ignore the warning. - Configure Webform Content Creator as above with
uidas the synchronization field machine name. - Map each form element to the corresponding user field.
The full step-by-step recipe is preserved at:
1 2 3 4 5 6 7 8 9 | |
Task patterns on webforms¶
A webform can declare task patterns via its third-party setting
fedms.patterns_form. When a user is added to a group, the
task_api model considers webforms with that pattern, and spawns
"Fill in this webform" tasks for the right users.
When a webform task is spawned, FedMS automatically creates an
empty draft submission linked to the task to disambiguate the
relationship — see
fedms/components/tasks#20.
Webform permissions for Content Managers¶
Content Managers need to be able to author webforms. The fix for
"webform permissions for Content Manager" is tracked at
fedms/support#23
and
fedms/support#34.
Common gotchas¶
- Confirmation type —
redirectbreaks book/event embeds; usereloadinstead. - Embed-in-modal limitation — webforms with media fields cannot
be opened inside a modal dialog. See
fedms/components/eca#7. uidwarning — ignore Drupal's warning about reserved key names when intentionally usinguidfor sync.
Next steps¶
- Books and content — where to embed webforms.
- Task patterns — wiring webforms into the task engine.