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 Robin S
      Pages At Bottom
      Keeps selected pages at the bottom of their siblings.
      A "bottom page" will stay at the bottom even if it is drag-sorted to a different location or another page is drag-sorted below it (after Page List is refreshed the bottom page will still be at the bottom).
      Newly added sibling pages will not appear below a bottom page.
      The module also prevents the API methods $pages->sort() and $pages->insertAfter() from affecting the position of bottom pages.
      Note: the module only works when the sort setting for children on the parent page/template is "Manual drag-n-drop".
      Why?
      Because you want some pages to always be at the bottom of their siblings for one reason or another. And someone requested it. 🙂
      Usage
      Install the Pages At Bottom module.
      Select one or more pages to keep at the bottom of their siblings. If you select more than one bottom page per parent then their sort order in the page list will be the same as the sort order in the module config.

       
      https://github.com/Toutouwai/PagesAtBottom
      https://modules.processwire.com/modules/pages-at-bottom/
    • By Robin S
      Another little admin helper module...
      Template Field Widths
      Adds a "Field widths" field to Edit Template that allows you to quickly set the widths of inputfields in the template.

      Why?
      When setting up a new template or trying out different field layouts I find it a bit slow and tedious to have to open each field individually in a modal just to set the width. This module speeds up the process.
      Installation
      Install the Template Field Widths module.
      Config options
      You can set the default presentation of the "Field widths" field to collapsed or open. You can choose Name or Label as the primary identifier shown for the field. The unchosen alternative will become the title attribute shown on hover. You can choose to show the original field width next to the template context field width.  
      https://github.com/Toutouwai/TemplateFieldWidths
      https://modules.processwire.com/modules/template-field-widths/
    • By horst
      Croppable Image 3
      for PW 3.0.20+
      Module Version 1.1.16
      Sponsored by http://dreikon.de/, many thanks Timo & Niko!
      You can get it in the modules directory!
      Please refer to the readme on github for instructions.
       
      -------------------------------------------------------------------------
       
      Updating from prior versions:
       
      Updating from Croppable Image 3 with versions prior to 1.1.7, please do this as a one time step:
      In the PW Admin, go to side -> modules -> new, use "install via ClassName" and use CroppableImage3 for the Module Class Name. This will update your existing CroppableImage3 module sub directory, even if it is called a new install. After that, the module will be recogniced by the PW updater module, what makes it a lot easier on further updates.
      -------------------------------------------------------------------------
       
      For updating from the legacy Thumbnail / CropImage to CroppableImage3 read on here.
       
      -------------------------------------------------------------------------
       
    • By MoritzLost
      UPDATE: I have published a stable version of this module!
      Discussion thread:
      Github: https://github.com/MoritzLost/TextformatterPageTitleLinks
      ---
      Hello there,
      I'm working on a tiny textformatter module that searches the text for titles of other pages on your site and creates hyperlinks to them. I'm not sure if something like this exists already, but I haven't found anything in the module directory, so I wrote my own solution 🙂
      It's not properly tested yet and is still missing some functionality I would like to implement, so at the moment it should be considered in BETA. Features include limiting the pages that will get searched by template, and adding a custom CSS class to the generated hyperlinks. As I'm writing this I noticed that it will probably include unpublished and hidden pages at the moment, so yeah ... it's still in development alright 😅
      You can download the module from Github:
      https://github.com/MoritzLost/TextformatterPageTitleLinks
      There's some more information in the readme as well.
      Anyway, let me know what you think! I'm happy about any feedback, possible improvements or ideas on how to improve the module. Cheers.
    • By blad
      Hi guys!
      I just uploaded a module to explore files based on elFinder. By default it will show the "Files" folder.
      Screenshots:

      Video:
       
      To do:
       More options To fix:
       The function of rotating or scaling an image fails  Image editors V 1.01 (view issue)
      Fixed the bug working with the Multi-Language support ( translation of folders ). Fixed the name of elfinder.en  Github:
      https://github.com/LuisSantiago/ProcessElFinder/
      I hope you like it.