Score:0

can't get multistep ajax webform work with computed field

sj flag

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 ?

id flag
Could you please limit the code sample to the smallest possible one that exhibits the bug?
Sudha avatar
sj flag
@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.
id flag
This requires four computed fields to reproduce then? Are fields like `test_length_label` crucial to reproducing the bug?
Sudha avatar
sj flag
@cilefen Thanks. I got your point. I have updated the code as per your comment. Your help will be appreciated.
id flag
What is the exact validation error? Is anything logged by Drupal?
Sudha avatar
sj flag
Name field is required and name field is highlighted as required.
Sudha avatar
sj flag
Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/145108/discussion-between-sudha-and-cilefen).
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.