Forum

Thread tagged as: Question, Problem, Forms

Perch:input disables the form input field

Hello,

I am trying to turn a form into a perch:form, but when I change my input field to a perch:input field, it disables the input field.

Original form template:

                <form class="contact-form row columns_padding_10" method="post" action="./">
                    <div class="col-sm-6">
                        <div class="contact-form-name">
                            <label for="name">Naam
                                            <span class="required">*</span>
                                        </label>
                            <input type="text" aria-required="true" size="30" value="" name="name" id="name" class="form-control" placeholder="Naam*" />
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="contact-form-subject">
                            <label for="subject">Onderwerp
                                            <span class="required">*</span>
                                        </label>
                            <input type="text" aria-required="true" size="30" value="" name="subject" id="subject" class="form-control" placeholder="Onderwerp">
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="contact-form-phone">
                            <label for="phone">Telefoonnummer
                                            <span class="required">*</span>
                                        </label>
                            <input type="text" aria-required="true" size="30" value="" name="phone" id="phone" class="form-control" placeholder="Telefoonnummer">
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="contact-form-email">
                            <label for="email">Mailadres
                                            <span class="required">*</span>
                                        </label>
                            <input type="email" aria-required="true" size="30" value="" name="email" id="email" class="form-control" placeholder="Mailadres*">
                        </div>
                    </div>
                    <div class="col-sm-12">

                        <div class="contact-form-message">
                            <label for="message">Bericht</label>
                            <textarea aria-required="true" rows="5" cols="45" name="message" id="message" class="form-control" placeholder="Uw bericht"></textarea>
                        </div>
                    </div>

                    <div class="col-sm-12">

                        <div class="contact-form-submit topmargin_10">
                            <button type="submit" id="contact_form_submit" name="contact_submit" class="theme_button color1 wide_button">Verzenden</button>
                        </div>
                    </div>
                </form>

Screenshot: https://imgur.com/4gvzTY6

changed to a perch:form and perch:input

                <perch:form class="contact-form row columns_padding_10" method="post" app="perch_forms">
                    <div class="col-sm-6">
                        <div class="contact-form-name">
                            <label for="name">Naam
                                            <span class="required">*</span>
                                        </label>
                            <perch:input type="text" name="name" id="name" class="form-control" placeholder="Naam*" />
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="contact-form-subject">
                            <label for="subject">Onderwerp
                                            <span class="required">*</span>
                                        </label>
                            <input type="text" aria-required="true" size="30" value="" name="subject" id="subject" class="form-control" placeholder="Onderwerp">
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="contact-form-phone">
                            <label for="phone">Telefoonnummer
                                            <span class="required">*</span>
                                        </label>
                            <input type="text" aria-required="true" size="30" value="" name="phone" id="phone" class="form-control" placeholder="Telefoonnummer">
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="contact-form-email">
                            <label for="email">Mailadres
                                            <span class="required">*</span>
                                        </label>
                            <input type="email" aria-required="true" size="30" value="" name="email" id="email" class="form-control" placeholder="Mailadres*">
                        </div>
                    </div>
                    <div class="col-sm-12">

                        <div class="contact-form-message">
                            <label for="message">Bericht</label>
                            <textarea aria-required="true" rows="5" cols="45" name="message" id="message" class="form-control" placeholder="Uw bericht"></textarea>
                        </div>
                    </div>

                    <div class="col-sm-12">

                        <div class="contact-form-submit topmargin_10">
                            <button type="submit" id="contact_form_submit" name="contact_submit" class="theme_button color1 wide_button">Verzenden</button>
                        </div>
                    </div>
                </perch:form>

Screenshot: https://imgur.com/IEACffV

Diagnostic report:

 PHP 7.0.26 is up to date
 MySQL 5.5.5-10.2.11-MariaDB is up to date
 Image processing available
Summary information
Perch Runway: 3.0.12, PHP: 7.0.26, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: b5c5906d452ec590732a93b051f3827e02749b83 $, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (3.0.12), assets (3.0.12), categories (3.0.12), perch_blog (5.6.1), perch_events (1.9.5), perch_forms (1.10)
App runtimes: <?php $apps_list = [ 'perch_blog', 'perch_events', 'perch_forms' ];
PERCH_LOGINPATH: /perch
PERCH_PATH: /home/kndrxwbst/domains/kendrix.website/public_html/lpf/perch
PERCH_CORE: /home/kndrxwbst/domains/kendrix.website/public_html/lpf/perch/core
PERCH_RESFILEPATH: /home/kndrxwbst/domains/kendrix.website/public_html/lpf/perch/resources
Image manipulation: GD
PHP limits: Max upload 64M, Max POST 64M, Memory: 128M, Total max file upload: 64M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
REQUEST_URI: /perch/core/settings/diagnostics/
DOCUMENT_ROOT: /home/kndrxwbst/domains/kendrix.website/public_html/lpf
HTTP_HOST: lpf.kendrix.website

I have turned a dozen of forms into perch:forms without any problems, but I can't seem to get this one to work.

Mike Hendriks

Mike Hendriks 0 points

  • 3 years ago
Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Hello Mike,

The id attribute is required in <perch:form>:

<perch:form id="contact"  method="post" app="perch_forms">

Does adding an id solves your problem?

No, it still doesn't work.

Thanks for the reply.

Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Is the template getting rendered? Could you check what's being output in your browser's developer tools? What do you get? Do you get a <form> tag or a <perch:form> tag?

It does output a <perch:form> tag and also a <perch:input> field.

Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Ok that's the problem. It should be outputting regular HTML tags.

How are you displaying the form on your page.php?

I have made a layout which I display using:

    // FORMULIER
    perch_layout('contact/formulier');

Formulier contains the form template in my original post.

Here is the full template:

<section class="ls columns_padding_25 section_padding_top_75 section_padding_bottom_100">
    <div class="container">
        <div class="row">

            <div class="col-md-8 to_animate" data-animation="scaleAppear">

                <h3 class="text-uppercase">Neem contact op</h3>

                <perch:form id="contact" class="contact-form row columns_padding_10" method="post" app="perch_forms">
                    <div class="col-sm-6">
                        <div class="contact-form-name">
                            <perch:label for="name">Naam
                                            <span class="required">*</span>
                                        </perch:label>
                            <perch:input type="text" name="name" id="name" class="form-control" placeholder="Naam*" />
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="contact-form-subject">
                            <perch:label for="subject">Onderwerp
                                            <span class="required">*</span>
                                        </perch:label>
                            <perch:input type="text" aria-required="true" size="30" value="" name="subject" id="subject" class="form-control" placeholder="Onderwerp" />
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="contact-form-phone">
                            <perch:label for="phone">Telefoonnummer
                                            <span class="required">*</span>
                                        </perch:label>
                            <perch:input type="text" aria-required="true" size="30" value="" name="phone" id="phone" class="form-control" placeholder="Telefoonnummer" />
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="contact-form-email">
                            <perch:label for="email">Mailadres
                                            <span class="required">*</span>
                                        </perch:label>
                            <perch:input type="email" aria-required="true" size="30" value="" name="email" id="email" class="form-control" placeholder="Mailadres*" />
                        </div>
                    </div>
                    <div class="col-sm-12">

                        <div class="contact-form-message">
                            <perch:label for="message">Bericht</label>
                            <perch:input type="textarea" name="message" id="message" class="form-control" placeholder="Uw bericht" />
                        </div>
                    </div>

                    <div class="col-sm-12">

                        <div class="contact-form-submit topmargin_10">
                            <button type="submit" id="contact_form_submit" name="contact_submit" class="theme_button color1 wide_button">Verzenden</button>
                            <perch:input type="cms" />
                        </div>
                    </div>
                </perch:form>
            </div>
            <!--.col-* -->

            <div class="col-md-4 to_animate" data-animation="scaleAppear">

                <h3 class="text-uppercase">Contact Info</h3>

                <p>
                    <i class="fa fa-map-marker highlight rightpadding_5" aria-hidden="true"></i> Address
                </p>
                <p>
                    <i class="fa fa-phone highlight rightpadding_5" aria-hidden="true"></i> phone number
                </p>
                <p class="greylinks">
                    <i class="fa fa-envelope highlight rightpadding_5" aria-hidden="true"></i> <a href="mailto:your@mail.com">mail</a>
                </p>
                <p class="greylinks">
                    <strong>Name</strong><br>
                    Address
                </p>
            </div>
            <!--.col-* -->

        </div>
        <!--.row -->

    </div>
    <!--.container -->

</section>
Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Layouts are PHP files. <perch:form> and other Perch tags don't render in a layout.

You can use perch_content() instead. You can make it a shared region if you plan on reusing it across multiple pages.

Thanks alot Hussein! It is working now using perch_content().

This is my first time using runway, sorry for my rookie mistake!

Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

You're welcome. No need for apologies at all.

By the way, this is not specific to Runway. You should be able to do the same with Perch.

Ah, I see. I got used to using layouts for everything in runway, so I will clean up my code now.