DESKTOP EDITION CLOUD EDITION SERVER EDITION GUIDES FORUM

What is the name of the fields in the "fields" loop


#1

Hello to all the team. On invoices and quotes, a loop displays a number of fields (Invoice date, due date, référence du devis etc.). But the exact “name” of these fields does not appear. So I do not have total control to display these fields. What are they called? Is it possible to display them individually without going through this loop?


#2

Do you mean this?

{% for field in fields %}
    <div style="text-transform: capitalize;">{{ field.label }}</div>
    <div style="font-weight: bold; margin-bottom: 10px">{{ field.text }}</div>
{% endfor %}

(Yours may be a little different as this quote came from my customised invoice)

The field names are in field.label and the values are in field.text. The actual field count will depend on your settings (which features you have enabled and which you have disabled) and whether or not specific fields actually have values (for example, if there is no quote reference for an invoice, that field won’t get passed to the template and therefore won’t get displayed/printed). The actual field names (labels) will also vary based on your language settings.


#3

Expanding a little, both field.label and field.text are the names of the variables. But they are arrays, and as @Cognicom wrote, their content varies according to your setup and previous entries. It also varies by transaction type, because all transaction forms can display with the same theme and, therefore, use the same variables.

So the only way to display or suppress one element of the array is to apply conditional logic while looping through it.


#4

@chaazaam
This post maybe helpful.