Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example Webform usage #86

Open
wants to merge 48 commits into
base: main
Choose a base branch
from
Open

Example Webform usage #86

wants to merge 48 commits into from

Conversation

harumijang
Copy link
Contributor

@harumijang harumijang commented Jul 26, 2022

How to set up Webform REST on ACMS

  1. Download the Webform and Webform REST modules

  2. Enable REST resources "Webform Submit", "Webform Elements", "Webform Submission" on /admin/config/services/rest

  3. Set permissions /admin/people/permissions#module-rest for RESTful Web Services and check Anonymous User for the Webform related permissions

  4. Create a new webform if you have not already /admin/structure/webform. The code is currently hardcoded to read the field "field_webform" so you should name your field that in ACMS or change that line in the code to your field.

  5. Create a webform (Right now. text area, text input, submit, radio buttons, checkboxes, and a single checkbox are supported).

  6. Add a webform to one of your nodes then go to the page on the headless site.

@harumijang harumijang marked this pull request as ready for review August 2, 2022 22:29
@harumijang
Copy link
Contributor Author

Getting this build error after moving to a different package. I thought that having "include": ["**/*.ts, **/*.tsx"] to basic-starter/tsconfig.json would prevent this error.

image

@@ -0,0 +1,16 @@
import { DrupalClient } from 'next-drupal';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should initialize new Drupal Client in here. I think it needs to be something that is provided by the integrator from the Next.js application.

webformObject={additionalContent.webform}
id={additionalContent.webform.drupal_internal__id}
key={additionalContent.webform.drupal_internal__id}
customComponents={{ date: WebformDate }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is unclear based on these docs is that what is date? Is it the name of the form element or is it the type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type

settings={null}
error={error}
>
<input type="date" name="date" min="2022-01-01" max="2022-12-31" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the name should be dynamically coming from the backend?

@harumijang harumijang changed the title Webforms playground Example webforms usage Aug 18, 2022
@harumijang harumijang changed the title Example webforms usage Example Webform usage Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants