Forum

Thread tagged as: Problem, Error, Forms

perch_forms not working

I'm following these instructions to create a filterable list: https://solutions.grabaperch.com/architecture/user-filtered-lists

I've run into trouble using perch_forms. I have the Forms App installed and have placed the following where I want the form:

<?php perch_forms('villas_filter.html'); ?>

This is the forms template at perch/templates/forms/villas_filter.html:

<perch:form id="filter" method="get" id="villafilter">
    <h3>Search for a Villa:</h3>
    <div class="form-row">
        <perch:label for="location">Location <a href="/locations">View Map/Descriptions</a></perch:label>
        <perch:input type="select" id="location" class="select-location" options="All Locations|all,Kuta|kuta,Legian|legian,Seminyak|seminyak,Canguu and beyond|canguu-and-beyond,Umalas|umalas,Ubud|ubud,Sanur|sanur,Nusa Dua|nusa-dua,Uluwatu|uluwatu,Nusa Lembongan|nusa-lembongan,Lombok|lombok,Gilli Islands|gilli-islands,Other areas|other-areas" />
    </div>
    <div class="form-row">
        <div class="form-col form-col-price">
            <perch:label for="price">Price</perch:label>
            <perch:input type="select" id="price" class="select-price" options="Any Price,$100 - $300,$300 - $500,$500 - $700,$700+" />
        </div>
        <div class="form-col form-col-bedrooms">
            <perch:label for="bedrooms">Bedrooms</perch:label>
            <perch:input type="select" id="bedrooms" class="select-bedrooms" options="1+,2+,3+,4+,5+,6+,7+,8+,9+,10+,11+,12+" />
        </div>
    </div>
    <div class="form-row form-row-checkbox">
        <perch:label for="event" class="label-checkbox">
            <perch:input type="checkbox" id="event" value="true" /> Suitable for an event
        </perch:label>
    </div>
    <div class="form-action">
        <perch:input type="submit" class="button button-search" value="Search Villas" />
    </div>
</perch:form>

The form doesn't output. I've turned on debug mode along with output_debug but nothing is being output as the page stops rendering as soon as it gets to the perch_forms code. What am I doing wrong?

Brad Hardinge

Brad Hardinge 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you added the Forms app to your config/apps.php file?

Yes I have, this is the app.php code:

<?php
    $apps_list = array(
        'content',
        'perch_forms',
        'perch_blog',
        'perch_gallery',
    );
?>

Not sure what else to try?

Rachel Andrew

Rachel Andrew 394 points
Perch Support

Check your PHP error log and see what error is being thrown.

Ah, this is the error I am getting...

PHP Fatal error:  Call to undefined function perch_forms()

Explains the error - the function should be 'perch_form'. Might want to update the tutorial here: https://solutions.grabaperch.com/architecture/user-filtered-lists

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ah, you're right. That's a typo.