justb3a

Simple Contact Form

Recommended Posts

@justb3a: i increased the max_execution_time from 30 to 60 sec. the memory_limit is at 256M and still the same problem. :huh:

Share this post


Link to post
Share on other sites

@itsberni: 60 is not enough. Try the following values:

max_execution_time = 240
max_input_time = 240
memory_limit = 1024M 

Share this post


Link to post
Share on other sites

Hi Congomonster,

you have to change the fieldname. in your case scf_fullName in e.g. scf_Nachname. Be carefull. the prefix scf_ is important.

And you also have to change the values ( input - Tag ) in your form. But here you go without the prefix!

Don´t forget to adapt the fieldnames in your modulconfiguration. also without the prefix.

Hi itsberni,

thank you for answer. It worked except for the date field. :frantics:

For now it's perfect! :biggrin:

Share this post


Link to post
Share on other sites

@congomonster: I have to find / provide another solution for this issue. For now it's ok but it shouldn't be the solution to solve it that way...  :mellow:

Share this post


Link to post
Share on other sites

@itsberni: 60 is not enough. Try the following values:

max_execution_time = 240
max_input_time = 240
memory_limit = 1024M 

thanks, justb3a - i've tried this values.

After a very long period of time, the mails are appearing.

I think that's way to long. Could that be caused by the repeater, that slows down everthing in my case?!

the contactform is in a testphase already, so there are a lot of entries ( about 180 ).

If i try to delete data in the repeater, the script tooks again a very long period of time an after that, the tagged

data is not deleted. :(

Any ideas though?

Share this post


Link to post
Share on other sites

Can anybody help me?

I have been trying for two full days to get this module running - thats OK because I am still learning. With everything else so far (e.g. include a simpler contact form and make it work) I was able to figure it out by modifying stuff I found elsewhere but now I am stuck.

I installed the module, set up the template file and the HTML works: I get a page with fields and I can enter data. But when I press „submit“ nothing happens. I get no error message, nothing.

I have tried to address the module through php and through JS, I tried hundreds of variations of syntax, it seems I do something wrong addressing the module.

Could anybody please supply me with an example for a full and correct code and let me know where to insert it?

Thanks A LOT!

Share this post


Link to post
Share on other sites

Using a honeypot I am able to filter out almost all spambots surprisingly, that may just be me, but using this method I have been pretty successful. 

Share this post


Link to post
Share on other sites

@Kami: Please have a look at your log file (simplecontactform-log). 

Edit: Please set $config->debug in site/config.php to true and try again  ^_^

@itsberni: Sorry for answering that late. I guess we must transfer the form action to the frontend by using pagination (20 entrys a page).

Share this post


Link to post
Share on other sites

Thanks, I set $config->debug to "true" and restarted PW but in PW/Setup/Logs I only see a simplecontactform-spam-log, no simplecontactform-log?

Share this post


Link to post
Share on other sites

And no error message appears (frontend or error log). Does it reload the page if you press submit? Is there an entry in  simplecontactform-spam-log? There is a setting called antiSpamTimeMin, if you submit the form really fast, the content will be treated as spam. There should be an entry in the spam log. Try to set this setting (in module settings) to 0.

Share this post


Link to post
Share on other sites

There is an error message but it concerns a template I don´t use (?) so I am not sure it is related: "Error: Call to undefined function renderNav() (line 12 of /Applications/MAMP/htdocs/site/templates/basic-page.php)". Line 12 is: "renderNav($page->children);".

There is an entry in the spam-log but its date is from yesterday: "CSRF Token validation failed."
 

The page seems to reload when I press submit, it keeps the entries in "name" and "email" but not the entry in the message field. AntiSpamTimeMin is set to 0.

Share this post


Link to post
Share on other sites

There is an error message but it concerns a template I don´t use (?) so I am not sure it is related: "Error: Call to undefined function renderNav() (line 12 of /Applications/MAMP/htdocs/site/templates/basic-page.php)". Line 12 is: "renderNav($page->children);".

This is another error message which is not related to this module. Somewhere in your template you call renderNav($page->children) but this function doesn't exist. This function comes with a basic ProcessWire installation and is located in _func.php which is required by _init.php ($config->prependTemplateFile in config.php)

There is an entry in the spam-log but its date is from yesterday: "CSRF Token validation failed."

This module uses CSRF token validation, if you don't know what it's all about, have a look here. In your form there must be an hidden input field, make sure that it's still there (<input type='hidden' name='<?= $input->tokenName; ?>' value='<?= $input->tokenValue; ?>' class='_post_token' />).

Check also that there is another hidden input field: <input type="hidden" name="submitted" value="1">. Do not remove one of them!

Share this post


Link to post
Share on other sites

Hello, I installed this module. I have a problem when submitting the form, I get the error message to verify data. What could be the problem?

Example:

ASBSKSa.jpg

Edited by Bam Bino

Share this post


Link to post
Share on other sites

@Bam Bino: Did you remove some fields? I can't see scf-website as well as submitted. These fields are necessary for validation. If I just install the module without any config / html - css adaptions, it should look like this:

post-2759-0-79695600-1436778971_thumb.pn

Share this post


Link to post
Share on other sites

The scf-date field should be invisible as well. Please add in site/modules/SimpleContactForm/SimpleContactForm.module after line 424 var_dump($field); and paste the output (make sure $config->debug is set to true in site/config.php):

foreach ($form as $field => $value) {
  if (empty($value)) {
    var_dump($field);
    $error = true;
    continue;
  }
}

Share this post


Link to post
Share on other sites

Hi, justb3a. I did as you instructed, but I get zero output of var_dump when I submit the form. It goes like this:

1. I fill the form

lhXkJp7.png

2. When I submit it I get the error message:

yfQaRh8.png

3. When I resubmit the form I am redirected to home page:

pZB6qlt.png

4. As modules documentation says it means that it was marked as spam, so I open simplecontactform-spam-log.txt for the error information"

4gm8Cef.png

Share this post


Link to post
Share on other sites

I've run into an issue where if I trigger an error state (say by leaving the form blank or by skipping a required field) the next submission always redirects to the homepage while generating a "CSRF Token validation failed" message. Everything else is working presently. Any ideas?

(PW 2.6.1)

I have a couple of small feature suggestions that would be nice: 1) The ability to assign a "From" name for generated emails; 2) The ability to send messages to multiple recipients. Thanks!

Share this post


Link to post
Share on other sites

New version 0.1.2

* fixes CSRF token validation (Thanks!)

* adds option to overwrite email message

* adds "from name" for generated email

* allows multiple recipients

  • Like 4

Share this post


Link to post
Share on other sites

Hello,

I just need to setup a simple contact form so, I installed SimpleContactForm.

Then I went to Admin >> ModulesSimple >> Contact Form and followed the instruction.

After I included below code into my contact.php and refresh the page, nothing came out @ blank page.

<?php $modules->get('SimpleContactForm')->render(); ?>

If I have the budget I could buy myself the FormBuilder but sadly not so much at the moment.

Please tell me, is there any way to fix this issue or if there's something I overlooked ?

Thank you.

Edited by kongondo
Merged to SimpleContactForm's support forum

Share this post


Link to post
Share on other sites

I have managed to call the contact form by adding echo

<?php echo $modules->get('SimpleContactForm')->render(); ?> 

 but there are 2 more issues :

1) How do you replace unordered list bullets which appear near the form label ?

post-3657-0-81343700-1439976399_thumb.pn

2) When I submitted the form my browser got redirected to the Home page and found out the simple_contact_form.php don't have any value in action="./" . How to fix this ?

post-3657-0-75658500-1439976609_thumb.pn

Thank you

Share this post


Link to post
Share on other sites

@kradzcalypse:

1) A new template called simple_contact_form.php will be created in your site/templates directory. Once created you can/should modify the template as well as the fields to your own needs, just make sure to maintain the names of the fields. So you can substitute the list (<ul> <li>..) tags with divs or adapt your css and set "list-style: none;" for this list.

To hide the fields adapt the css using for example "display: none;".

2) The action is not empty. action="./" refers to the current page. Have a look at your log file (Admin > Setup > Logs > simplecontactform-log). I guess the spam protection applies here and redirects you to the home page.

----------------------------------------------------

PS: These are simple basics of CSS and HTML.  ^_^ 

  • Like 1

Share this post


Link to post
Share on other sites

Hi,

Thanks for your reply. 

Please have a look at my contact page : http://pesisirbrand.com/contact/

After filling up the contact form and press submit button the browser return the Home page but data never got submitted

to inbox here : http://pesisirbrand.com/scf-messages/

Admin > Setup > Logs > simplecontactform-log returned :

 

[FAILURE] Honeypot field was filled.

Share this post


Link to post
Share on other sites

The field you named "Web Url (Optional)" is not allowed to be filled. This field should be invisible. Spam boots are used to fill every field and the honey pot technique is one way to keep them out. Hide this field, add one field more to get a web url field if needed.

Share this post


Link to post
Share on other sites

Thanks justb3a,

It works. 

I tried adding 3 more input fields into the form (Address, Telephone Number & Identification) and then created 3 new fields in the admin section but where can I define the input id ( e.g : Inputfield_Alamat ) for those 3 new form fields ?

Here are things that I've done so far ..

simple_contact_form.php

<div class="form-group">
		<label class="col-md-3 control-label" for='Inputfield_Alamat'>Alamat<i class='toggle-icon fa fa-angle-down' data-to='fa-angle-down fa-angle-right'></i></label>
		<div class="col-md-9">

<input id="Inputfield_Alamat" class="form-control" name="Address" value="<?= $input->Alamat; ?>" type="text" maxlength="2048" placeholder="" />
		</div>
            </div>

site/modules/SimpleContactForm/SimpleContactForm.module

protected static $defaults = array(
    'fullName' => '',
    'Address' => '',
    'Telephone Number' => '',
    'Identification' => '',
    'emailTo' => '',
    'emailSubject' => 'New Web Contact Form Submission',
    'successMessage' => 'Thank you, your submission has been sent.',
    'errorMessage' => 'Please verify the data you have entered.',
    'emailMessage' => '',
    'emailServer' => 'noreply@server.com',
    'allFields' => 'fullName,Alamat,Telefon,KadPengenalan,email,message',
    'requiredFields' => 'fullName,Alamat,Telefon,KadPengenalan,email,message',
    'emailField' => 'email',
    'saveMessages' => true,
    'antiSpamTimeMin' => '0',
    'antiSpamTimeMax' => '90',
    'antiSpamPerDay' => '3',
    'antiSpamExcludeIps' => '127.0.0.1',
    'antiSpamCountAdditionalInputs' => '5',
    'useTwig' => false,
    'cleanup' => 0
  );

.....

.....

public static function getModuleConfigInputfields(array $data) {
    $fields = new InputfieldWrapper();
    $modules = wire('modules');

    // default config values
    $data = array_merge(self::$defaults, $data);

......
.......

     'Address' => array(
        'type' => 'InputfieldText',
        'description' => 'Fallback: Alamat',
        'size' => 45,
        'placeholder' => 'Alamat',
        'columnWidth' => 50
      ),
      'Telephone Number' => array(
        'type' => 'InputfieldText',
        'description' => 'Fallback: Telefon',
        'size' => 45,
        'placeholder' => 'Telefon',
        'columnWidth' => 50
      ),
      'Identification' => array(
        'type' => 'InputfieldText',
        'description' => 'Fallback: Kad Pengenalan',
        'size' => 45,
        'placeholder' => 'Kad pengenalan',
        'columnWidth' => 50
      ),

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Macrura
      Field Descriptions Extended
      This module enables you to extend field descriptions by dividing short descriptions with a longer text that is revealed in a toggle.
      Modules Directory: http://modules.processwire.com/modules/field-descriptions-extended/
      Github: https://github.com/outflux3/FieldDescriptionsExtended
      Extending your field descriptions using the standard field's description field.
      Once this module is installed, it will automatically search your description field for the presence of 5 dashes (-----).
      Any content above the 5 dashes will be visible and the content below the dashes will be hidden. A 'More...' link will appear at the end of the short description which when clicked will reveal the rest of the description.
      Using Simple Markdown Editor with the description field
      If you have Simple Markdown Editor (InputfieldSimpleMDE) installed, you can enable the field description to have that editor.
      *When using Simple MDE, you can use the button (Insert Horizontal Line) instead of typing 5 dashes. More about SimpleMDE.
      Extending your field descriptions using content from a ProcessWire Page for the field description.
      You may use the content from a ProcessWire page as a field description. This would allow you to easily insert images, links, and use hanna codes.
      To use page content for your field descriptions, please follow these instructions:
      Install Select Fields module (FieldtypeFields) http://modules.processwire.com/modules/fieldtype-fields/ Create a new field using this field type, e.g. field_select. Add the field to any template you will be using for your field descriptions. Setup your help pages (for example under a settings branch) where you will store the field description content,using the template containing the Field Select. Add content to a page and select the field where that content should show. To show a short text before the link to the longer content, separate them with 5 dashes Be sure to update your settings on this page, first enable page content descriptions,then specify the name of the Select Fields field, template to search, and content field. If you create a field description using this method, please note that the description field must be blank for contexts where you want the page content to appear.
      You can freely use template context for field descriptions, but the Page Content method is not context sensitive and will display under all contexts where the description is blank.
      ----
      original post:
      This is a new module, hope to release soon, which allows extended field descriptions, in currently 2 ways.
      The main feature of the module is that you can have a short description and then a 'more...' link which drops down a longer block of text.
      This is achieved by separating the intro/visible text and the rest with 5 dashes.

      Example setup:

      the 2nd way is if you are using AdminThemeUiKit, you can show extended field instructions in a panel. The content of the panel is edited on a regular PW page. This use case would probably not be that common, but if you had a field that required some extended instructions for how to use, this could be useful; Also, since this allows you to target information and instructions down at the field level, it could reduce the amount of documentation needed on a global level, since it is a lot more context targeted.

    • By Robin S
      Breadcrumb Dropdowns
      Adds dropdown menus of page edit links to the breadcrumbs in Page Edit.

      Installation
      Install the Breadcrumb Dropdowns module. The module requires ProcessWire >= v3.0.83 and AdminThemeUikit.
      There is a checkbox option in the module config that determines if the breadcrumb dropdowns will include pages that the user does not have permission to edit.
      Features/details
      The module adds an additional breadcrumb item at the end for the currently edited page. That's because I think it's more intuitive for the dropdown under each breadcrumb item to show the item's sibling pages rather than the item's child pages. In the dropdown menus the current page and the current page's parents are highlighted in a crimson colour to make it easier to quickly locate them in case you want to edit the next or previous sibling page. If the option to include uneditable pages is selected then those pages are indicated by a reduced text opacity and the "not-allowed" cursor is shown on hover. There is a limit of 25 sibling pages per dropdown for performance reasons and to avoid the dropdown becoming unwieldy. Incompatibilities
      This module replaces the AdminThemeUikit::renderBreadcrumbs method so will potentially be incompatible with other modules that hook the same method.
       
      https://modules.processwire.com/modules/breadcrumb-dropdowns/
      https://github.com/Toutouwai/BreadcrumbDropdowns
    • By joshuag
      Hey guys, 
      Thought I would share a quick preview of Designme. A module we (Eduardo @elabx and I) are building for visually laying out your templates/edit screens. 🙂
      This is a really quick, zero polish screen grab. FYI. 
      Video #2 - UPDATE
      This new video shows the following features in Designme:
      Re-arranging fields via Drag & Drop Re-sizing fields via Dragging. Adjusting field settings - with live refresh. Working on "hidden" fields while Designme is active. Creating New fields. Deleting fields. Creating/Deleting Tabs. Dragging fields between tabs. Creating fieldsets. Tagging/Un-tagging fields. Fields without headers expand when hovered (like checkboxes). Live filtering of fields in the sidebar. Ability to adjust (all) Template settings without leaving Designme. Template File Tree Editing Template files source code with ACE Editor. Editing Multiple files with ACE Editor. (New Tabs) Saving files. Techie stuff Fields load their own js/css dependancies. *ready to use on creation (*most fields)  Everything happens via Ajax to ProcessPageEdit (via module + hooks). Designme has a JS api that you can use.  All actions trigger events.  We would love any detailed feedback on what you see so far. If you are interested in testing Designme. Let me know below. 🙂
       
       
      Video #1. 
       
    • By dreerr
      TemplateEnginePug (formally TemplateEngineJade)
       
      This module adds Pug templates to the TemplateEngineFactory. It uses https://github.com/pug-php/pug to render templates.
      doctype html html(lang='en') head meta(http-equiv='content-type', content='text/html; charset=utf-8') title= $page->title link(rel='stylesheet', type='text/css', href=$config->urls->templates . 'styles/main.css') body include header.pug h1= $page->title if $page->editable() p: a(href=$page->editURL) Edit Project on GitHub: github.com/dreerr/TemplateEnginePug
      Project in modules directory: modules.processwire.com/modules/template-engine-pug/
       
      For common problems/features/questions about the Factory, use the TemplateEngineFactory thread.
       
    • By tpr
      ProcessNetteTester
      Run Nette Tester tests within ProcessWire admin.
      (continued from here)

      Features
      AJAX interface for running Nette Tester tests, in bulk or manually display counter, error message and execution time in a table run all tests at once or launch single tests show formatted test error messages and report PHP syntax errors stop on first failed test (optional) hide passed tests (optional) display failed/total instead passed/total (optional) re-run failed tests only (optional) auto scroll (optional) include or exclude tests based on query parameters start/stop all tests with the spacebar reset one test or all tests (ctrl+click) https://modules.processwire.com/modules/process-nette-tester/
      https://github.com/rolandtoth/ProcessNetteTester