Form Module: Form Hidden After Submission
Created 6 years ago by finnito

Hey,

When a I submit a form made with the Form module, a success message is displayed which is great, but for some reason the form is hidden on page load. What causes this behaviour and how can I disable it? Here is a screen recording of the behaviour: https://www.youtube.com/watch?v=lp1G255Pe54

Thanks!

ryanthompson  —  6 years ago Best Answer

I am going to merge that method out in the next version. Good thing!

ryanthompson  —  6 years ago

Can you post some code?

finnito  —  6 years ago

Sure thing,

I'm displaying the form by doing this: {{ forms_display('contact') }} and it renders out the form like this:

<form method="POST" action="https://canterburyplumbing.co.nz" accept-charset="UTF-8" class="form" enctype="multipart/form-data">
    <input name="_token" type="hidden" value="ImicZeOcoSOBSCKlMK9LVFoAzhiqjf5msgTy8b2G">
    <div class="card">
        <div class="card-block">
            <div class="field-group name">
                <div class=" form-group name-field text-field_type ">
                    <label class="control-label"> Name <span class="required">*</span></label>
                    <div class="input-wrapper">
                        <input value="" name="name" data-max="255" data-mask="" data-alias="" data-regex="" type="text" placeholder="Name" class="form-control" data-field="name" data-field_name="name" data-provides="anomaly.field_type.text">
                    </div>
                </div>
            </div>
            <div class="field-group email">
                <div class=" form-group email-field email-field_type ">
                    <label class="control-label"> Email <span class="required">*</span></label>
                    <div class="input-wrapper">
                        <input type="email" value="" name="email" placeholder="Email" class="form-control" data-field="email" data-field_name="email" data-provides="anomaly.field_type.email">
                    </div>
                </div>
            </div>
            <div class="field-group phone">
                <div class=" form-group phone-field text-field_type ">
                    <label class="control-label"> Phone </label>
                    <div class="input-wrapper">
                        <input value="" name="phone" data-max="255" data-mask="" data-alias="" data-regex="" type="text" placeholder="Phone" class="form-control" data-field="phone" data-field_name="phone" data-provides="anomaly.field_type.text">
                    </div>
                </div>
            </div>
            <div class="field-group message">
                <div class=" form-group message-field textarea-field_type ">
                    <label class="control-label"> Message </label>
                    <div class="input-wrapper">
                        <textarea name="message" data-max="" rows="6" placeholder="Message" class="form-control" data-field="message" data-field_name="message" data-provides="anomaly.field_type.textarea"></textarea>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <button class="btn btn-sm btn-success " name="action" value="submit" type="submit"> Submit </button>
</form>

and after the form is submitted and the next page has the flash message on it, the form is not rendered at all. I'm not saying that it has display: none on it, but that no HTML is output at all where the {{ forms_display('contact') }} tag is.

finnito  —  6 years ago

My problem was fixed by your answer on another question @ryanthompson but this is an ongoing bug with {{ forms_display('contact') }} I believe.

ryanthompson  —  6 years ago Best Answer

I am going to merge that method out in the next version. Good thing!

ryanthompson  —  6 years ago

Don't forget to mark answers if you can please.

finnito  —  6 years ago

Hahaha sweet! Was finding it a very confusing method.