Forum

Thread tagged as: Question

Problem with Perch Forms

Hi,

I'm trying to use Perch forms but when I look at the source of the webpage it appears to prepend Form_1 to form elements including to the form itself.

I tried having no action="" attribute but then I only get a 404 message, however with the action attribute set to be the same page as where the form is being submitted from; I don't get 404 and while I get a success message; nothing appears in Perch, which leads me to the conclusion that Forms should not be an app but rather a native application.

Garth Holmes

Garth Holmes 1 points

  • 6 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

What does your form template look like?

Can you please show us your Diagnostic Report?

<perch:form id="contact" method="post" action="/contact/1index.php" app="perch_forms"> 

<perch:content id="intro" type="textarea" label="Contact" textile="true" editor="markitup" size="m" />

<div>
<perch:label for="name">Name</perch:label>
<perch:input id="name" type="text" required="true" label="Name" />
<perch:error for="name" type="required">Please add a your name</perch:error>
</div>

<div>
<perch:label for="email">Email</perch:label>
<perch:input id="email" type="email" required="true" label="Email" placeholder="you@company.com" />
<perch:error for="email" type="required">Please add a your email address</perch:error>
<perch:error for="email" type="format">Please check a your email address</perch:error>
</div>

<div>
<perch:label for="message">Message</perch:label>
<perch:input id="message" type="textarea" required="true" label="Message" />
<perch:error for="message" type="required">Please add a message</perch:error>
</div>

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

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

</perch:form>

Perch: 2.8.6, PHP: 5.4.39, MySQL: mysqlnd 5.0.10 - 20111026 - $Id: c85105d7c6f7d70d609bb4c000257868a40840ab $, with PDO Server OS: Linux, cgi-fcgi Installed apps: content (2.8.6), assets (2.8.6), categories (2.8.6), perch_forms (1.8.3), perch_backup (1.2) App runtimes: <?php include(PERCH_PATH.'/core/apps/content/runtime.php'); ?> PERCH_LOGINPATH: /perch PERCH_PATH: /home/sitemaster/public_html/perch PERCH_CORE: /home/sitemaster/public_html/perch/core PERCH_RESFILEPATH: /home/sitemaster/public_html/perch/resources Image manipulation: GD PHP limits: Max upload 32M, Max POST 64M, Memory: 128M, Total max file upload: 32M Resource folder writeable: Yes DOCUMENT_ROOT: /home/sitemaster/public_html HTTP_HOST: REQUEST_URI: /perch/core/settings/diagnostics/ SCRIPT_NAME: /perch/core/settings/diagnostics/index.php

If it helps, I tend to "declare" everything prior to use:

<?php include('perch/runtime.php'); ?>
<?php perch_content_create('Title', array('template' => 'title.html','multiple' => false)); ?>
<?php perch_content_create('Heading', array('template' => '_heading/contact.html','multiple' => false)); ?>
<?php perch_content_create('Form', array('template' => 'form.html','multiple' => false)); ?>
<?php include('includes/head/header.php'); ?>

dataselect:

<h1 class="heading-border"><perch:content id="course" label="Course" type="dataselect" region="Title" options="title" page="/contact/1index.php" /></h1>

and

<?php set_include_path($_SERVER['DOCUMENT_ROOT']); ?>
<?php include('includes/head/contact.php'); ?>
<body>
<div class="page">
<?php include('includes/head/top.php'); ?>
<div id="bottom_section">
<?php perch_content('Heading'); ?>
<?php perch_content('Form'); ?>
</div>
</div>
<?php include('includes/footer/footer.php'); ?>
</body>
</html>

I enabled debug in config.php and got the following:

Debug Message
SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='a8481af82fa81d535532a5d58061f551' LIMIT 1
UPDATE perch2_users SET userHash='982562e2fd585d8b0d23cbd2285c1de0' WHERE userID=1
SELECT p.privKey FROM perch2_user_privileges p
SELECT * FROM (SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID
SELECT * FROM perch2_forms
Attempting app installation: perch_forms
SHOW TABLES LIKE "perch2_forms"
Queries: 7
Memory: 1.9128

Array
(
    [type] => 32
    [message] => PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20100525/php_mysql.dll' - /usr/local/lib/php/extensions/no-debug-non-zts-20100525/php_mysql.dll: cannot open shared object file: No such file or directory
    [file] => Unknown
    [line] => 0
)
Drew McLellan

Drew McLellan 2638 points
Perch Support

You need to add the Forms app to your apps.php file.

Hi Drew,

Like this?

<?php
    include(PERCH_PATH.'/core/apps/content/runtime.php');
    include(PERCH_PATH.'/addons/apps/perch_forms/runtime.php');
?>

Got it working, thank you.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Does that not work?