Twig condition in views

Created on 22 October 2023, about 1 year ago

Problem/Motivation

In case that you need to add any condition to display form field with a twig it does not work properly.

1. Create a new view
2. Add form field for example called "field_form_alfa"
3. Hide form field
4. Add some conditional field like status with values "Open" and "Closed"
5. Add custom text field ( or use title and Override the output of this field with custom text) and add twig (or token):

{% if field_status == 'Open' %}
{{ field_form_alfa }}
{% endif %}

So if status is Open I would like to see form field. Everything works and I can see it. However when I change the value of that form field and try to change it again - it overrides it automatically to EMPTY.

However when I unhide the original field everything works (but now there are two columns - one original and one custom which shows form input field only when the status is Open).....

Result :
From some reason currently form field needs to be alwyas visible to work properly, if it is hidden and displayed with token or twig in another field it is not working and overrides the values - make them EMPTY.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΈπŸ‡°Slovakia coaston

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024