Docly

Prefill HTML and textarea

Estimated reading: 2 minutes
CampaignSuite makes it possible to have a text box or HTML field in your form automatically filled with values from other fields in the form. This can be especially useful for showing a detailed summary of the information entered on the form on your last page of the form.
Note

This functionality only works if your form consists of more than 1 page. The fields are filled when the visitor switches pages in the form.

The images below show two examples of how you can fill a text box and HTML field.

The values of the fields can be entered by the syntax: {input_field_id} Where field_id is the ID of the field in your form.
Did you know

If you add the parameter ?cs_post=true to the URL of the page where your form is located, you will see (when you click the button at the bottom of the form) exactly which field IDs and values you can use when prefilling text boxes and HTML fields.

Timber plugin

It is also possible to apply some logic to the code in the fields. If you have installed the plugin Timber it is also possible to use .twig logic. See this website for an explanation of the possibilities.

Some examples of .twig logic are:

				
					{% if "{input_1}" == "Ideal" %}
    This is an Ideal payment
{% else %}
    This is not an Ideal payment
{% endif %}				
			
				
					{% switch "{input_3}" %}
    {% case 'Ideal' %}
        <p>Ideal payment</p>
    {% case 'Direct debit' %}
        <p>Debit</p>
    {% case 'Creditcard' %}
    {% case 'Sofort' %}
        <p>Other payment method</p>
    {% default %}
        <p>Unknown payment method</p>
{% endswitch %}