Hello,
Is there a way to get the results directly while filling the form like for example the module webform calculator for drupal 7?

See the results on the form without all these manipulations would be really cool ...

Cordialy

Comments

yzan created an issue. See original summary.

  • jrockowitz committed 2df7a8b on 2981370-computed-element-ajax
    Issue #2981370: computed elements.
    
  • jrockowitz committed 66ffaa2 on 2981370-computed-element-ajax
    Issue #2981370: computed elements.
    

  • jrockowitz committed 319b5d3 on 2981370-computed-element-ajax
    Issue #2981370: computed elements.
    
  • jrockowitz committed c3886bb on 2981370-computed-element-ajax
    Issue #2981370: computed elements.
    
jrockowitz’s picture

  • jrockowitz committed 21d9262 on 2981370-computed-element-ajax
    Issue #2981370: computed elements. Setup example.
    
  • jrockowitz committed 9f73004 on 2981370-computed-element-ajax
    Issue #2981370: computed elements. Setup test example.
    

  • jrockowitz committed 940dfc2 on 2981370-computed-element-ajax
    Issue #2981370: computed elements. Setup example.
    

  • jrockowitz committed dbc4918 on 2981370-computed-element-ajax
    Issue #2981370: computed elements. Setup example.
    
yzan’s picture

Hi
I have to do what?

  • jrockowitz committed 2b96164 on 2981370-computed-element-ajax
    Issue #2981370: computed elements. Setup example.
    
jrockowitz’s picture

Status: Active » Needs review
StatusFileSize
new170.25 KB
new30.93 KB

Please test and review the attached patch which includes a dedicated example of a computed elements with client-side calculations via Ajax (/form/example-computed-elements-ajax).

If you want to earn commit credit and help me out, please draft the change record.

yzan’s picture

I will work on it right now ...

yzan’s picture

StatusFileSize
new167.55 KB

Hello ,

I do not see the correspondence between the lines to delete and those that should be added.
I try a manual patch, and can not go further without knowing if it is an anomaly.
can you enlighten me on this?

yzan’s picture

I really hope that it will work

jrockowitz’s picture

@yzan You can also checkout this branch 2981370-computed-element-ajax

yzan’s picture

I want to help you,
Please, give me the steps to follow to get this result as on the GIF image.
I could finally test for writing the changes.
I'm not comfortable with the codes at the moment ..

jrockowitz’s picture

yzan’s picture

Hello,
It works on several combinations.
you integrate it?

I will write the change record ..

jrockowitz’s picture

@yzan Please mark this RTBC.

You can create change record draft with the GIF from above.

yzan’s picture

Status: Needs review » Reviewed & tested by the community

  • jrockowitz committed 0dbc5ea on 8.x-5.x
    Issue #2981370 by jrockowitz, yzan: computed elements
    
jrockowitz’s picture

Status: Reviewed & tested by the community » Fixed

I tweak the change record and committed the patch.

Woot!

yzan’s picture

The work is great.

Woot!

yzan’s picture

Do I have to use the development version in the meantime?

jrockowitz’s picture

Yes, I will be tagging a new release next week.

yzan’s picture

Thank you for your precious help.
  Thanks to you, I discovered more about drupal ...

yzan’s picture

example_computed_elements_ajax

Hello,
  After the update, I do not see the example.
/ admin / structure / webform / manage / example_computed_elements_ajax.
One day to look for it ....
I missed a step?
cordially

jrockowitz’s picture

If you have the webform examples module installed you have manually import the example_computed_elements_ajax webform.

yzan’s picture

Hello,
I succeeded.

It is visible now in the examples.
I uninstalled webform sample, launched the update script, and then reinstalling webform sample.

I will be able to continue to advance on the forms.
Thank you for your answer.

yzan’s picture

StatusFileSize
new75.11 KB
new204.45 KB
new144.81 KB

Hello,
It seems, when using keys different from a, b and c the display of the dynamic result does not work anymore.

jrockowitz’s picture

Using number as keys might be causing the problem.

In your Twig template, you might need to change data.1 to date['1'].

Can you please create an example webform, export it, and upload it here?

The latest dev release includes an 'Export' tab when building a webform.

yzan’s picture

Hello,
It works.
Indeed, keys with numbers were the problem.
Numbers replaced by letters.
Thanks for the information.
  do I still download an example of a webform?

jrockowitz’s picture

@yzan Your issue is more related to Twig syntax then computed elements. There is no need to post any examples.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

yzan’s picture

StatusFileSize
new17.88 KB
new6.42 KB

Hello,
Is there a way to calculate the sum of Twigs?

I have attached a sketch and, creates an example of a web form, it is download here.

I tried to add all the twigs but did not seem to work.

A bright ideas will be welcome ...

cordially

yzan’s picture

StatusFileSize
new22.13 KB

I also include an image of what I got from webform_calaculator 2 years ago ...

yzan’s picture

jrockowitz’s picture

Try using {{ webform_token('[webform_submission:values:element_key]', webform_submission) }} instead of {{ data.element_key }} which return the calculated value.

yzan’s picture

A visual example will help me to be more comfortable with the idea that you emit ...

jrockowitz’s picture

I can't be providing custom support for your specific project.

Please post your question to https://drupal.stackexchange.com/questions/tagged/webforms or https://www.drupal.org/forum

yzan’s picture

Yes I understand . I just wanted to know how to try your suggestion 37.
I will follow your advice and visit the links