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 Soma
      LogMaintenance
      A simple ProcessWire module to give some maintenance control over log files. I found myself often having lots of log files for different things that can grow more or less quickly to a size where they can be difficult to maintain. The built in Logger of PW does a good job of giving you the possibility to delete or prune logs. But it has to be done manually and sometimes a log grows into millions of lines, which makes it often impossible to even prune it as it's too large.
      LogMaintenance uses LazyCron to run the maintenance task and there's several settings you can setup on a global or per log basis.
      Archive: will create zip files for each log file in logs/archive/ folder and add the log each time the maintenance is run to a subfolder containing the datetime.
      Lines: keeps logs to a certain number of lines 
      Days: keeps the log to a certain number of days
      Bytes: keeps the log to a certain amount of bytes
      Each setting is checked from top down, the first setting to contain something is used. So if you check the "Archive" option, all other settings are ignored and logs are archived everytime the LazyCron is executed. If you want to keep your logs to a certain amount of bytes just leave all other settings to 0 or blank.
      Per Log Settings
      There's a textarea that you can use to setup a config for a specific log file one per line. All the logs you define here ignore the global settings above. The syntax for the settings is:
      logname:[archive]:[lines]:[days]:[bytes] 
      errors:1:0:0:0 // would archive the errors log messages:0:10000:0:0 // will prune the errors log to 10000 lines  
      The module can be found on github for you to check out. It's still fresh and I'm currently testing.
      https://github.com/somatonic/LogMaintenance
    • By teppo
      Fieldtype Page IDs is a third party Fieldtype that, simply put, stores Page references as integers (Page IDs).
      This fieldtype was built as a quick and dirty workaround for Page Reference fields' inability handle self-references due to circular reference issues. A project I've been working on for a while now includes a combination of RepeaterMatrix content blocks and tagging/categorization system that would've resulted in a lot of duplicate pages (and plenty of unnecessary manual work for content editors) had I used built-in Page Reference fields, and thus a new Fieldtype felt like the most sensible approach.
      Fieldtype Page IDs was designed to be loosely compatible with Page References in order to make conversions between the two feasible, but it is quite limited feature wise:
      largely due to the fact that stored values are actually just integers with no connection to Pages whatsoever some advanced selectors and related features are not supported, and page values can't be directly accessed configuration settings are limited to the bare essentials (selector string and Inputfield class) only a handful of Inputfields (AsmSelect, Checkboxes, Text) are (currently) supported Anyway, in case you need to store Page IDs (and Page IDs only) and are happy with the limitations mentioned above, feel free to give this Fieldtype a try. It has been working fine for me in one particular project, but hasn't been tested that much, so please tread carefully – and let me know if you run into any issues.
      GitHub repository: https://github.com/teppokoivula/FieldtypePageIDs
      Modules directory: https://modules.processwire.com/modules/fieldtype-page-ids/
    • By daniels
      This is a lightweight alternative to other newsletter & newsletter-subscription modules.
      You can find the Module in the Modules directory and on Github
      It can subscribe, update, unsubscribe & delete a user in a list in Mailchimp with MailChimp API 3.0. It does not provide any forms or validation, so you can feel free to use your own. To protect your users, it does not save any user data in logs or sends them to an admin.
      This module fits your needs if you...
      ...use Mailchimp as your newsletter / email-automation tool ...want to let users subscribe to your newsletter on your website ...want to use your own form, validation and messages (with or without the wire forms) ...don't want any personal user data saved in any way in your ProcessWire environment (cf. EU data regulation terms) ...like to subscribe, update, unsubscribe or delete users to/from different lists ...like the Mailchimp UI for creating / sending / reviewing email campaigns *I have only tested it with PHP 7.x so far, so use on owners risk
      EDIT:
      I've updated the module to 0.0.4. I removed the instructions from this forum, so I don't have to maintain it on multiple places. Just checkout the readme on github 🙂
      If you have questions or like to contribute, just post a reply or create an issue or pr on github. 
    • By bernhard
      WHY?
      This module was built to fill the gap between simple $pages->find() operations and complex SQL queries.
      The problem with $pages->find() is that it loads all pages into memory and that can be a problem when querying multiple thousands of pages. Even $pages->findMany() loads all pages into memory and therefore is a lot slower than regular SQL.
      The problem with SQL on the other hand is, that the queries are quite complex to build. All fields are separate tables, some repeatable fields use multiple rows for their content that belong to only one single page, you always need to check for the page status (which is not necessary on regular find() operations and therefore nobody is used to that).
      In short: It is far too much work to efficiently and easily get an array of data based on PW pages and fields and I need that a lot for my RockGrid module to build all kinds of tabular data.

      Basic Usage

       
      Docs & Download
      https://modules.processwire.com/modules/rock-finder/
      https://gitlab.com/baumrock/RockFinder/tree/master
       
      Changelog
      180528, v1.0.4 add custom select statement option 180516 change sql query method, bump version to 1.0.0 180515 multilang bugfix 180513 beta release <180513 preview/discussion took place here: https://processwire.com/talk/topic/18983-rocksqlfinder-highly-efficient-and-flexible-sql-finder-module/
    • By blynx
      Hej,
      A module which helps including Photoswipe and brings some modules for rendering gallery markup. Feedback highly appreciated
      (Also pull requests are appreciated 😉 - have a new Job now and don't work a lot with ProcessWire anymore, yet, feel free to contact me here or on GitHub, Im'm still "online"!)

      Modules directory: http://modules.processwire.com/modules/markup-processwire-photoswipe
      .zip download: https://github.com/blynx/MarkupProcesswirePhotoswipe/archive/master.zip
      You can add a photoswipe enabled thumbnail gallery / lightbox to your site like this. Just pass an image field to the renderGallery method:
      <?php $pwpswp = $modules->get('Pwpswp'); echo $pwpswp->renderGallery($page->nicePictures); Options are provided like so:
      <?php $galleryOptions = [ 'imageResizerOptions' => [ 'size' => '500x500' 'quality' => 70, 'upscaling' => false, 'cropping' => false ], 'loresResizerOptions' => [ 'size' => '500x500' 'quality' => 20, 'upscaling' => false, 'cropping' => false ], 'pswpOptions' => (object) [ 'shareEl' => false, 'indexIndicatorSep' => ' von ', 'closeOnScroll' => false ] ]; echo $pswp->renderGallery($page->images, $galleryOptions); More info about all that is in the readme: https://github.com/blynx/MarkupProcesswirePhotoswipe
      What do you think? Any ideas, bugs, critique, requests?
      cheers
      Steffen