0

I have a weird issue with the webform module, whenever I modify the submit button (change text, add class) it doesn't show up on the page anymore (nor in the source code). If I delete it, it is back to default (the label in the OPERATION column says customize again) and it works, but it disappear if I change it again.

I didn't do any weird modification beside creating a Twig template for it. But since it works when I leave it to its default value I doubt the issue lies there. Hopefully one of you guys can help me.

Here is the YAML code:

markup:
  '#type': markup
  '#markup': |
    <h2>
      Je publie une offre d'emploi
    </h2>
job:
  '#type': textfield
  '#title': job
  '#title_display': invisible
  '#placeholder': 'Fonction recherchée*'
  '#required': true
  '#required_error': 'Fill in a valid job'
  '#pattern': '^[a-zA-Z]*$'
company:
  '#type': textfield
  '#title': company
  '#title_display': invisible
  '#placeholder': 'Nom de la société*'
  '#required': true
  '#required_error': 'Fill in a company'
  '#pattern': '^[a-zA-Z0-9]*$'
job_description:
  '#type': textarea
  '#title': 'job description'
  '#title_display': invisible
  '#placeholder': 'Description de la fonction'
  '#required': true
  '#required_error': 'Fill in a description'
contract:
  '#type': select
  '#title': contract
  '#title_display': invisible
  '#options':
    CDD: CDD
    CDI: CDI
  '#empty_value': 'Type de contrat*'
  '#required': true
  '#required_error': 'Choose a contract type'
job_schedule:
  '#type': select_other
  '#title': 'job schedule'
  '#title_display': invisible
  '#options':
    'Full time': 'Full time'
    'Part time': 'Part time'
  '#empty_value': 'Travail à temps...*'
  '#required': true
  '#required_error': 'Select a schedule'
location:
  '#type': textfield
  '#title': location
  '#title_display': invisible
  '#placeholder': 'Lieu*'
  '#required': true
publication_date:
  '#type': date
  '#title': 'publication date'
  '#description': 'Date de publication*'
  '#title_display': invisible
  '#description_display': before
  '#prepopulate': true
  '#required': true
  '#required_error': 'Select a publication day'
  '#min': today
  '#max': '+2 months'
  '#step': '1'
end_date:
  '#type': date
  '#title': 'end date'
  '#description': 'Date limite*'
  '#title_display': invisible
  '#description_display': before
  '#required': true
  '#min': '+2 weeks'
url:
  '#type': url
  '#title': URL
  '#title_display': invisible
  '#placeholder': 'URL: RH ou Plateforme pour postuler*'
  '#required': true
  '#required_error': 'Fill in a valid URL'
phone:
  '#type': tel
  '#title': phone
  '#description': 'Mes informations (pour &ecirc;tre contact&eacute; par BioWin)'
  '#title_display': invisible
  '#description_display': before
  '#placeholder': 'Numéro de téléphone*'
email:
  '#type': email
  '#title': email
  '#title_display': invisible
  '#placeholder': 'Adresse email'
  '#pattern': '^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,10})+$'
actions:
  '#type': webform_actions
  '#title': 'Submit button(s)'
  '#submit__label': Envoyer
  '#submit__attributes':
    class:
      - cta
4
  • Can you please post the webform's source YAML so that we can reproduce the issue? Are you using the latest release of the webform module?
    – jrockowitz
    Mar 1, 2018 at 12:56
  • I updated the post, I'm using the version 8.x-5.0-rc1 which was the latest at the start of the project I'm working on
    – MathiasH
    Mar 1, 2018 at 13:23
  • I am not seeing any issues with Drupal 8.5.x and Webform 8.x-5.0-rc3 + with the Bartik theme. Are you able to reproduce the issue using the Bartik theme and/or simplytest.me?
    – jrockowitz
    Mar 1, 2018 at 13:43
  • Maybe it has something to do with the fact that I'm using a custom theme, thanks for helping anyway, I'll just leave it default and force some style on it
    – MathiasH
    Mar 1, 2018 at 13:49

1 Answer 1

0

If you have a custom twig template for your webform the custom submit button needs to be referenced differently than the default.

Default Submit Button reference:

{{ element.actions }}

Customized Submit Button reference:

{{ element.elements.actions }}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.