Forum

Thread tagged as: Problem, Forms

can't register additional form

I'm using perch on localhost. I tried to add a second form on the website, so I took an individual id for the new form, but it didn't register in the forms list (The form itself displays at the pages and in the browser). So I duplicated the running contact-form and changed the id to "test". But this also didn't register as a new form. The codeexample is from the running form which doesn't register Any Ideas? Thank You!

My diagnostics:


Perch: 3.1.2, PHP: 7.1.11, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $, with PDO Server OS: WINNT, apache2handler Installed apps: content (3.1.2), assets (3.1.2), categories (3.1.2), perch_forms (1.12) App runtimes: <?php $apps_list = array( 'content', 'perch_forms' ); PERCH_LOGINPATH: /faly/perch PERCH_PATH: C:\xampp\htdocs\faly\perch PERCH_CORE: C:\xampp\htdocs\faly\perch\core PERCH_RESFILEPATH: C:\xampp\htdocs\faly\perch\resources Image manipulation: GD PHP limits: Max upload 2M, Max POST 8M, Memory: 128M, Total max file upload: 2M F1: 3b606135b33e6a102526838f4152a807 Resource folder writeable: Yes HTTP_HOST: localhost DOCUMENT_ROOT: C:/xampp/htdocs REQUEST_URI: /faly/perch/core/settings/diagnostics/ SCRIPT_NAME: /faly/perch/core/settings/diagnostics/index.php

my template:

<perch:form id="test-form" method="post" app="perch_forms" autocomplete="on" role="form">

<div class="kontaktformular">
<perch:label for="name">Name</perch:label>
<perch:input type="text" id="name" placeholder="Max Musterfrau" required label="Name">
<perch:error for="name" type="required">Bitte geben Sie Ihren Namen ein</perch:error>
</div>

<div class="kontaktformular">
<perch:label for="email">E-Mail</perch:label>
<perch:input type="email" id="email" required label="E-Mail" placeholder="muster.name@genuss.at">
<perch:error for="email" type="required">Bitte geben Sie Ihre E-Mail-Adresse ein</perch:error>
<perch:error for="email" type="format">Bitte kontrollieren Sie Ihre E-Mail-Adresse</perch:error>
</div>

<div class="kontaktformular">
<perch:label for="tel">Telefonnummer für Rückfrage</perch:label>
<perch:input type="tel" id="tel" label="Telefon" placeholder="0123 123 45 67">
<perch:error for="tel">Bitte geben Sie Ihre Telefonnummer ein</perch:error>
</div>

<div class="kontaktformular">
<perch:label for="message">Nachricht</perch:label>
<perch:input type="textarea" id="message" required label="Message" placeholder="Ihre Nachricht an uns">
<perch:error for="message" type="required">Bitte geben Sie Ihre Nachricht ein</perch:error>
</div>
<div class="kontaktformular">
<perch:label for="checkbox" class="checkboxlabel">Ich bin mit der Speicherung<br>meiner Daten einverstanden</perch:label>
<perch:input type="checkbox" id="einverstanden" value="true" required aria-checked="false">
</div>

<div>
<perch:input type="submit" id="submit" value="Senden">
</div>

<perch:success>
<perch:content id="success" type="textarea" label="Thank you message" textile editor="markitup">
</perch:success>
</perch:form>
Christoph Freyer

Christoph Freyer 0 points

  • 2 years ago
Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Hello Christoph,

Dashes - should be avoided for id: https://docs.grabaperch.com/templates/attributes/id/

Use letters, numbers and underscores only for an id.

You can instead use contact_form, test_form etc.

Thanks, I changed to underscores and also the wording. startet XAMPP amd pPerch new, but it doesn't registrate the form in the forms-list again.

Have you submitted the form at least once from the browser. This is the process which registers the new form in Perch.

You must submit it once for it to showup.

Yes it is submitted like all other pages. The Page with the form appears in the Browser, but the form does not work - I think because it isn't registered. I als tried to refresh the backend-page with the forms list, but there will only appear the first form.

Christoph,

The form will register the first time it is submitted from the browser.

If the form will not submit then it means there is a problem with the form coding.

Please submit your form template now that you have made changes, so we can check it for errors.

EDIT: Also you may need to turn on debug to find out where things are failing.

Debug at the bottom of the page in the Browser:

Debug Message - Perch 3.1.2
[20] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0

Array
(
    [time] => format
)

[1] SELECT * FROM perch3_pages WHERE pagePath='/faly/reservierung.php' LIMIT 1
Using template: \templates\pages\attributes\seo.html
[5] SELECT regionKey, regionHTML FROM perch3_content_regions WHERE regionPage='/faly/reservierung.php' OR regionPage='*' ORDER BY regionPage DESC

my form:

<perch:form id="form_reservation" method="post" app="perch_forms" autocomplete="on" role="form">
    <fieldset class="datetimeperson">
        <div class="kontaktformular">
            <perch:label for="date">Datum</perch:label>
            <perch:input type="date" id="date" required>
            <perch:error for="name" type="required">Bitte geben Sie ein Datum ein</perch:error>
        </div>
        <div class="kontaktformular">
            <perch:label for="time">Uhrzeit</perch:label>
            <perch:input type="time" id="time" value="15:30" pattern="hh:mm" required>
            <perch:error for="name" type="required">Bitte geben Sie die Uhrzeit ein</perch:error>
        </div>
        <div class="kontaktformular">
            <perch:label for="number">Personen</perch:label>
            <perch:input type="number" id="personen" min="1" max="100" step="1" required>
            <perch:error for="name" type="required">Bitte geben Sie die Personenanzahl ein</perch:error>
        </div>
        <p>Bitte beachten Sie, dass Reservierungen nur durch Bestätigung unsererseits wirksam werden. Vielen Dank!</p>
        <p>Für kurzfristige Reservierungen rufen Sie uns unter <a href="tel:+43225253228">+43&#x2009;(0)&#x2009;2252&#x2009;532&#x2009;28</a> an.</p>
    </fieldset>

    <fieldset class="kontakt">
        <div class="kontaktformular">
            <perch:label for="name">Name</perch:label>
            <perch:input type="text" id="name" placeholder="Max Musterfrau" required label="Name">
            <perch:error for="name" type="required">Bitte geben Sie Ihren Namen ein</perch:error>
        </div>

        <div class="kontaktformular">
            <perch:label for="email">E-Mail</perch:label>
            <perch:input type="email" id="email" required label="E-Mail" placeholder="muster.name@genuss.at">
            <perch:error for="email" type="required">Bitte geben Sie Ihre E-Mail-Adresse ein</perch:error>
            <perch:error for="email" type="format">Bitte kontrollieren Sie Ihre E-Mail-Adresse</perch:error>
        </div>

        <div class="kontaktformular">
            <perch:label for="tel">Telefonnummer für Rückfragen</perch:label>
            <perch:input type="tel" id="tel" label="Telefon" placeholder="0123 123 45 67">
            <perch:error for="tel">Bitte geben Sie Ihre Telefonnummer ein</perch:error>
        </div>

        <div class="kontaktformular">
            <perch:label for="message">Mitteilung/Wünsche</perch:label>
            <perch:input type="textarea" id="message" label="Message" placeholder="Ihre Zusatzinformation">
        </div>

        <div class="kontaktformular">
            <perch:label for="checkbox" class="checkboxlabel">Ich bin mit der Speicherung<br>meiner Daten einverstanden</perch:label>
            <perch:input type="checkbox" id="einverstanden" value="true" required aria-checked="false">
        </div>

        <div>
            <perch:input type="submit" id="submit" value="Reservieren">
        </div>

        <perch:success>
            <perch:content id="success" type="textarea" label="Thank you message" textile editor="markitup">
        </perch:success>
    </fieldset>
</perch:form>

the debug at https://localhost/faly/perch/addons/apps/perch_forms/ where is only shown one form instad of two

Debug Message - Perch 3.1.2
[1] SELECT u.*, r.* FROM perch3_users u, perch3_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='815adcd16a24b150d9e938289b842615' LIMIT 1
UPDATE perch3_users SET userHash='a21386409414b6a6ddfb8f15f4492846' WHERE userID='1'
[20] SELECT settingID, settingValue, userID FROM perch3_settings WHERE userID=1 OR userID=0 ORDER BY userID ASC
[7] SELECT itemValue FROM perch3_menu_items WHERE itemType='app'
[1] SELECT * FROM perch3_forms
[1] SELECT mi.*, p.privKey FROM perch3_menu_items mi LEFT JOIN perch3_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=0 ORDER BY itemOrder ASC LIMIT 0, 1
[2] SELECT mi.*, p.privKey FROM perch3_menu_items mi LEFT JOIN perch3_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=1 ORDER BY mi.itemOrder ASC
[1] SELECT itemTitle FROM perch3_menu_items WHERE itemType='app' AND itemValue='perch_forms' LIMIT 1
[1] SELECT mi.*, p.privKey FROM perch3_menu_items mi LEFT JOIN perch3_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=0 ORDER BY itemOrder ASC LIMIT 1, 10
[2] SELECT mi.*, p.privKey FROM perch3_menu_items mi LEFT JOIN perch3_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=2 ORDER BY mi.itemOrder ASC
File: \addons\apps\perch_forms\modes\forms.list.post.php
[3] SELECT COUNT(*) AS qty FROM perch3_forms_responses WHERE formID=1 AND responseSpam=0
[1] SELECT responseCreated FROM perch3_forms_responses WHERE formID=1 ORDER BY responseCreated DESC LIMIT 1
[3] SELECT COUNT(*) AS qty FROM perch3_forms_responses WHERE formID=1 AND responseSpam=0
Queries: 14
Memory: 1.9404
Array
(
[time] => format
)

In your form you are having an issue with the format... Why not remove the time field for now and see if things are working.

This error isn't showing up because you dont have a perch:error tag for the field time

Thanks you are great. I conmmented out one part after the other. Now it works except if I try to use the time. Is it correct, that Perch does not work with <perch:input type="time">? I could not find this type in the specs. There is only "datetime" and "date". Do you know a workaround, because for picking the time it is not practicable.

You could always pass the time into the form unless you are needing the person filling the form to select a time... Otherwise you may need to come up with a better method then timestamping form submissions. I am thinking the datetime is already captured with each submission, so I am not sure what your asking of the form filler when it comes to time. A datetime field would already be populated with the current time and date upon submission.

It's a reservation-form for a coffehouse & bakery. That's why the customer has to pick the desired time. I didn't wanted to take a jQuery-Timepicker. Maybe I can try it with a text or numberfield.

or create a select field with time increments of 10-15 minutes. I have a few of these fields which have a real long list of select options which I do as template includes to keep from having a really long master template. Often I use template includes for things like...years, makes, colors and such.