
Hello.
First, I need to say that I'm a complete newbie on Drupal so, sorry if my question is stupide.
I have a question (need help) regarding element in webform (and how to create a more complex one if it's possible)
First, I was positively surprised to see, on the text field element, that it's possible to have prefix and suffix. In English, the $ goes before an amount but after if the form is in French. (it would be useful to have a separate space for currency that would switch side automatically, depends on the language used
However, I was wondering how to create a new element that would cover different scenario.
Sorry, the example is using tax form element
- The easy one already covered by the existing element (Description + amount field (9 digits +2 decimals, negative values allowed). Field title deactivated.
- The a bit more complex case, also covered by the existing element (Description + prefix $ + amount field (9 digits +2 decimals, negative values allowed). Field title deactivated.
- Now with 2 Prefix I guess. (Description + prefix = + prefix $ + amount field (9 digits +2 decimals, negative values allowed). Field title deactivated.
- More complex. Now we have a black box, which should be the field Title. So, (Description + Field Title in Black box + prefix = + prefix $ + amount field (9 digits +2 decimals, negative values allowed).
- Interesting in this situation, a screen reader should read ABC first, then description, = , $ and the field
-
(https://www.dropbox.com/scl/fi/17eox4cbevp6v4wi03kry/4.png?rlkey=e8x23gm...)
- A bit more complex. Now we add a white box. So, (Description + Field Title in Black box + prefix = + prefix $ + amount field (9 digits +2 decimals, negative values allowed) + white box. Note the double lime at the bottom.
- The screen reader should read ABC, 9A, description, =, $, and field.
-
(https://www.dropbox.com/scl/fi/nwdcldylemru6lhsdevj8/5.png?rlkey=t4jqyrr...)
Here is even more complicated.
XYZ is actually the description of the second field. So, between the description and its field, we have another field and a calcul.
(https://www.dropbox.com/scl/fi/3qqymo324zz0y8gzrfjz3/6.png?rlkey=a022reu...)
Is it possible to create an element that could manage any variation of the 5 points and a second, I guess a Layout element that could allow the last example ?
Thank you for your help
Comments
Here are some references
Here are some references
1. Webform 8.x-5.x - Computed Elements.
2. Custom Webform Element in Drupal.
3. Webform Custom Options Elements.