When you query a webform in Gatsby graphql you must specify the options label and value.
The problem is that select field options can either be null or an array. We can't predict if the editor creating the webforms will add a select field or not so we always have to query options even though the form may or may not have a select field. GraphQL can't do conditions if a value is null or not.
In gatsby query the webform you just created with the following:
export const query = graphql`
query ($formId: String!) {
webformWebform(drupal_internal__id: { eq: form_id_here }) {
drupal_internal__id
drupal_id
title
category
description
status
elements {
name
type
options {
label
value
}
attributes {
name
value
}
}
}
}
`;
By default add an array of options with even if the field is not a select field.
The gatsby-drupal-webform plugin builds select form fields off of the type 'select' so the options will be ignored.
Active
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
No activities found.