0

When ever I use multistep webform with computed field and try to enter data in second page, webform redirect me to first page with validation error. Source code of my webform,

    page_1:
      '#type': wizard_page
      '#title': 'Page 1'
      name:
        '#type': textfield
        '#title': Name
        '#required': true
    page_2:
      '#type': wizard_page
      '#title': 'Test Page'
      test_table:
        '#type': webform_table
        '#title': Test
        '#title_display': none
        test_length:
          '#type': table_row
          '#title': Length
          test_length_material:
            '#type': number
            '#title': 'test Length Current'
            '#title_display': none
            '#placeholder': '0'
          test_length_material_1:
            '#type': computed_twig
            '#title': 'test Length Comp'
            '#template': '{{( data.test_length_material )}}'
            '#store': true
            '#ajax': true
            '#title_display': none
        test_width:
          '#type': table_row
          '#title': Width
          test_width_material:
            '#type': number
            '#title': 'test Width Current'
            '#title_display': none
            '#placeholder': '0'
          test_width_material_1:
            '#type': computed_twig
            '#title': 'test Width Material 1'
            '#template': '{{( data.test_width_material )}}'
            '#store': true
            '#ajax': true
            '#title_display': none
        test_thickness:
          '#type': table_row
          '#title': Thickness
          test_thickness_material:
            '#type': number
            '#title': 'test Thickness Current'
            '#title_display': none
            '#placeholder': '0'
          test_thickness_material_1:
            '#type': number
            '#title': 'test Thickness Material 1'
            '#placeholder': '0'
            '#title_display': none
        test_volume:
          '#type': table_row
          '#title': volume
          test_volume_computed:
            '#type': computed_twig
            '#title': 'test Volume Material'
            '#template': '{% if data.test_length_material|length and data.test_width_material|length and data.test_thickness_material|length %} {{ (( data.test_length_material * data.test_width_material * data.test_thickness_material ) / 1000000) }}{% endif %}'
            '#ajax': true
            '#title_display': none
          test_volume_computed_1:
            '#type': computed_twig
            '#title': 'test Volume Material 1'
            '#template': '{% if data.test_length_material|length and data.test_width_material|length and data.test_thickness_material_1|length %} {{ (( data.test_length_material * data.test_width_material * data.test_thickness_material_1 ) / 1000000) }}{% endif %}'
            '#ajax': true
            '#title_display': none

Webform version is 6.1.3. Also ajax setting is set true for above webform. For more clarity, I have configure my webform in simplytest.me. Click Here. Anyone have any idea why it is not working ?

7
  • Could you please limit the code sample to the smallest possible one that exhibits the bug?
    – cilefen
    Apr 4, 2023 at 16:42
  • @cilefen, the bug come at any time. Means as soon as I move to next page or while adding data for next page element. I already minimize my sample code as much as possible.
    – Sudha
    Apr 4, 2023 at 16:48
  • This requires four computed fields to reproduce then? Are fields like test_length_label crucial to reproducing the bug?
    – cilefen
    Apr 4, 2023 at 16:55
  • @cilefen Thanks. I got your point. I have updated the code as per your comment. Your help will be appreciated.
    – Sudha
    Apr 4, 2023 at 17:15
  • What is the exact validation error? Is anything logged by Drupal?
    – cilefen
    Apr 4, 2023 at 17:27

0

Your Answer

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

Browse other questions tagged or ask your own question.