0

I have a form which was built using composer - there is about 12 fields in it and at the minute if completed without a required field or there is an error in the form the form is loaded again blank to complete. What is the best way to retain those values or is it best with some sort of validation?

Form code below:

{exp:freeform:composer
    form_name="food_network"
    composer_template_name="food_network"
    return="/foodnetwork/join-us/join-us-thank-you"
    form:class="form-horizontal contact-form"
}
    <div class="ff_composer">
{composer:page}
    {composer:rows}
            <div class="line">
        {composer:columns}
                <div class="unit size1of{composer:column_total}">
                {if composer:field_total == 0}

                {/if}
            {composer:fields}
                {if composer:field_label}
                    {if composer:field_type == 'nonfield_captcha'}
                        {if captcha}
                        <p>
                            {composer:field_label}
                        </p>
                        {/if}
                    {if:else}
                        <label {if composer:field_name != ''}
                            for="freeform_{composer:field_name}"
                            {/if}>
                            {composer:field_label}
                            {if composer:field_required}
                            <span class="required_item">*</span>
                            {/if}
                        </label>
                    {/if}
                {/if}
                {if composer:field_output}
                    {if composer:field_type == 'nonfield_title'}
                        <h2>{composer:field_output}</h2>
                    {if:elseif composer:field_type == 'nonfield_captcha'}
                        {if captcha}
                                {captcha}<br />
                                <input
                                    type="text"
                                    name="captcha"
                                    value=""
                                    size="20"
                                    maxlength="20"
                                    style="width:140px;" />
                        {/if}
                    {if:else}
                        <p>{composer:field_output}</p>
                    {/if}
                {/if}
            {/composer:fields}
                </div>
        {/composer:columns}
            </div>
    {/composer:rows}
{/composer:page}
    </div>
{/exp:freeform:composer}
0

Someone raised this issue previously, the answer from Solspace at the time was no. I always submit via Ajax, then I can smoothly show errors, or feedback messages.

Although I stumbled across this question which indicates that values are stored in a {freeform:field:short_name} tag...? Not tried.

Another Solspace response.

Other solutions: Using JavaScript & PHP - the issue here is that Freeform posts to an ACT url, not the actual page, so wouldn't be able to use GET or POST back onto the same (return) page.

JQuery Cookie Plugin

localstorage (same link as above, 2nd answer)

JQuery Cookie

But to be honest, it'll be far easier to just use Ajax than any of the above.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.