justb3a

Simple Contact Form

224 posts in this topic

Never! change anything in the module code!

Just go to module settings (Admin > modules > SimpleContactForm > Edit) and add there the fields. Click submit, reload the form, you will see the new fields appended.

Please have a look at the documentation!

post-2759-0-15114000-1440412681_thumb.pn

Share this post


Link to post
Share on other sites

I'm having some troubles with the form. 

I've setup everything on my localhost and every thing seems to be working fine. Then i've copied everything to my server and for some reason the form stopped working. 

When I fill in all the field i get an error: 'Please verify the data you have entered.' even though everything looks fine. The weird part is that is doesn't say anything in the Logfile. 

Do you have any idea what the problem could be?

Share this post


Link to post
Share on other sites

Thankyou for building out this form. I was trying to setup the plugin, but everytime I remove a field name I get the following error: 

Error: Call to a member function save() on null (line 1098 of /home/marmil113/marshhospital.com/site/modules/simplecontactform/SimpleContactForm.module)

Any idea what I can do?

Share this post


Link to post
Share on other sites

@carlos: I guess there is something broken with your database because the fieldgroup failed to save after removing a field. Is this a production installation? If not, I would recommend to deinstall this module and check the clear data option (please do a backup before). After that have a look at your database and clear all stuff generated by this module if there’s something left. If the deinstallation with the clean option fails, you have to do this manually.

I tested it again and everything is working as expected. 

Share this post


Link to post
Share on other sites

I've been playing around with simple contact form and it works great!

I'm pretty new to all this, i'm trying to send the form using ajax ( thats so the page doesn't refresh right? ), iv'e included jquery.simplecontactform.js using 

   <script src="<?php echo $config->urls->templates?>scripts/jquery.simplecontactform.js"></script>

on my main page.

but what do i do with 

if ($('.js-simplecontactform').length) {

$.simplecontactform($('.js-simplecontactform'));
}

iv'e tried adding it to my main page using <script> and also tried <?php> neither works.

Also is there a way to style the send confirmation text?

heres some examples of what i've done so far.

http://ianjburgess.com/screenshot/Screen%20Shot%202015-10-14%20at%202.40.10%20PM.png

http://ianjburgess.com/screenshot/Screen%20Shot%202015-10-14%20at%202.40.59%20PM.png

Share this post


Link to post
Share on other sites

@Mido: Not the best but simplest solution:

  •  include jQuery
  •  include SimpleContactForm script
  •  include a general js file (main.js for example) which contains the function call you mentioned above

To style the confirmation text, modify the template, add a class and add CSS for that class.

Share this post


Link to post
Share on other sites

Hey

I really like this module and got it working quite well. There's only a few issues which I've encountered. Some mails are being sent directly and other need a wait time of maybe 30 minutes to be send to the email I've set in the settings. I've excluded my IP for the spam option yet it takes a long time for some messages to get through. Any idea what triggers this?

In the /scf-messages/ I can still see all the messages right away after they have been accepted by the system.  Could it still have something to do with the spam filter?

edit: Tried another IP too, still waiting for the mail...

edit 2: Last received mail took 2h to arrive

edit 3: Now they seem to come straight away... weird...

Share this post


Link to post
Share on other sites

hi,

I'm quite sure that this behaviour is not related to this module. The spam filter only checks some stuff and if everything is fine it hands the mail over to the mail agent and saves the message. Have a look at your mail log, maybe there is a queue. If the message was saved successfully, the spam checks are passed without any problem.

Share this post


Link to post
Share on other sites

Thanks @justb3a for your module, I am finally getting to use it :)

TL;DR

Is there something I need to configure in SCF to ensure it uses the WireMailSMTP module to send mail rather than in-built/default methods in PW? Thanks for any comments.

Background

I would like to sent mail via Mandrill and so as I have in the past with the PW Forms module I have installed WiremailSMPT; I noticed you said SCF now supports WireMail. I assumed that this meant when email was sent from the SCF if WireMailSMTP was installed it would automatically go via that module (and it's settings (Mandrill in my case)), but so far I am finding emails are arriving AOK but not via the WireMailSMTP module (as Mandrill is not listed in the route).

Share this post


Link to post
Share on other sites

I began editing simple_contact_form.php and found I was getting [FAILURE] CSRF Token validation failed. I back-tracked and found that, apparently, reindenting the code of the original form file with a Sublime Text plugin caused the errors..? I tried to diff the original versus the reindented one but as far as I could see nothing was 'wrong', just differently indented.

No time now to do stuff like try an alt diff tool in case the first missed something, but I thought I'd share in case this helps anyone else.

@justb3a if a copy of the indented-and-broken code would be helpful just let me know and I'll publish it on Dropbox or similar.

Share this post


Link to post
Share on other sites

@alan: Did you check that CSRF token validation works? If you load the form (frontend) there should be a hidden input containing a generated name and value:

<input type="hidden" id="_post_token" name="TOKEN1234567891X1234567891" value="A1B2c3d4efgHIj5klLmno6pQrstUVwxy" />

As said above, the name and value are generated, make sure it's not hardcoded. Also have a look at your log file (simplecontactform-log), all errors are displayed there.

I've never used WireMailSMTP – if you've figured out how to use it, please let me know!  ;)

1 person likes this

Share this post


Link to post
Share on other sites

@all Right now all is good and I am just trying to work out how to have SCF use WireMailSMTP rather than native PW transport.

It uses it out of the box, mean: you haven't to do anything in regard of SCF. SCF uses wiremail(), - and if you have installed and setup wiremailSMTP, it is used instead of the basic wiremail, which uses the PHP mail function.

1 person likes this

Share this post


Link to post
Share on other sites

@justb3a Thanks, yes the token is there and since I undid the reindenting of code it works AOK. Also thanks I have used the log to see what was wrong (very helpful, I also spotted that my test emails had hit the IP address limit per day so I upped it for testing :)

@horst Thanks, yes I assumed that it was used. But I am pretty sure it's not being used...

History: I installed and used SCF to send email (via PW built in wiremail I assume). Then I installed WireMailSMTP and set it to use my Mandrill credentials.

But email is arriving without showing Mandrill as the sender (view email headers also shows no mention of Mandrill.com) and based on all my other uses of WiremailSMTP+Mandrill I assume (where Mandrill is listed) I assume this mean Mandrill and therefore WireMailSMTP are being bypassed (I guess?).

Env: • WireMailSMTP passes it's connectivity test. • I have debug turned on.

If there's anything I can do to help test what may be happening I'd be happy to test and report.

Thanks in advance for any suggestions.

1 person likes this

Share this post


Link to post
Share on other sites

I use it on one site with wiremailSMTP and it works. But I haven't used it together with Mandrill.

I think you use a recent or latest version of SCF? (earlier version hasn't supported wiremail())

You may check in the headers of your emails for the User-Agent, e.g. ProcessWire/WireMail or ProcessWire/WireMailSMTP or ...

1 person likes this

Share this post


Link to post
Share on other sites

@horst Thanks for the suggestions, I will check and report back in case it's of any help to others.

1 person likes this

Share this post


Link to post
Share on other sites

@horst I checked and

  • SCF is 0.1.2 which is the latest at the moment = ✔
  • header says "...X-Mailer: ProcessWire/WireMail..." = ✖

so my setup (WireMailSMTP ver 0.1.13 on a PW 2.7.0 site and SCF) seems to be working AOK but emails are bypassing WireMailSMTP :'(

@justb3a and/or @horst : if there is anything I could do here to help fix this for me (and I assume others) then I would be happy to try stuff and report back/thanks for any suggestions you may have :)

1 person likes this

Share this post


Link to post
Share on other sites

Fixed the problem where WireMailSMTP is being bypassed in favour of WireMail...

@justb3a I would usually leave module code 100% alone, but comparing how mail is called in another site I noticed it was different, so I edited `SimpleContactForm.module` around line 478 like this: 

// Below original module code bypasses WireMailSMTP
// $wireMail = new WireMail();

// Below does not bypass WireMailSMTP
$wireMail = wireMail();

and email is then sent via WireMailSMTP. If I edit it back to the original then it bypasses WireMailSMTP and I can switch back and forth depending on how I leave the code around line 478.

If this is this something you would like me to log on git etc then please let me know as I would love to have an official (unedited) copy of your excellent module that used WireMailSMTP.

Sorry if I explained that all badly and thanks again for this module, cheers, -Alan

3 people like this

Share this post


Link to post
Share on other sites

@alan: WOW! What a great find.  ^-^  You are right. I have checked this and yes, on the site I thought it would working together, it also bypasses SMTP as you described it.

@justb3a: please can you fix this with one of the next releases?

1 person likes this

Share this post


Link to post
Share on other sites

Thanks for the fix @justb3a and glad this helped your site also @horst ^_^

1 person likes this

Share this post


Link to post
Share on other sites

new version 0.2.0 brings in some new features:


  • supports multiple instances
  • allows usage of full ProcessWire API in options
  • allows to render more than one contact form on a page
  • allows to send more than one email
  • makes validation hookable
  • read on
4 people like this

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 bernhard
      Hi,
      just stumbled over a little module that i built for my last project. it helped me to test performance of my rockdatatables module to generate 3000 random json datasets and i want to share it with you. maybe it saves some time for someone.
      https://gitlab.com/baumrock/RockDummyData/
      easy example:
      $rdd = $modules->get('RockDummyData'); for($i=0; $i<15; $i++) { // this has to be inside the for-loop to always get a new dummy $dummy = $rdd->getDummy(); echo date("d.m.Y H:i:s", $dummy->timestamp) . "<br>"; } more advanced:
      $json = new stdClass(); $json->data = array(); $rdd = $modules->get('RockDummyData'); for($i=0; $i<3000; $i++) { // this has to be inside the for-loop to always get a new dummy $dummy = $rdd->getDummy(); $obj = new stdClass(); $obj->name = $dummy->forename . ' ' . $dummy->surname; $obj->position = $dummy->job; $obj->office = $dummy->city; $obj->color = $dummy->color; $obj->start_date = new stdClass(); $obj->start_date->display = date('d.m.Y',$dummy->timestamp); $obj->start_date->sort = $dummy->timestamp; $obj->salary = rand(0,10000); $json->data[] = $obj; } echo json_encode($json); you have to store your random datasets on your own into the /data folder. there are several services for creating all kinds of random data on the web - if you know one service that allows sharing those datasets let me know and i can include common needed data into the module
    • By AndySh
      Hello!
      I need your assistance please. I purchased the module FormBuilder. Unfortunately, the module discontinued delivering customer submissions to e-mail box specified in the module settings. Direct mailing to the e-mail box works OK. The module settings stays the same and are correct, like "Send e-mail to administrator(s) is checked. The last version of FormBuilder 3.0 has been installed. Please advise how to resolve the issue becase I cannot get orders from customers anymore (((
    • By kixe
      As described in this post (https://processwire.com/talk/topic/8551-custom-urls-for-pages/?p=82742) the option 'Name Format Children' under the tab 'Family' in template settings doesn't work properly and also not as expected. I had a look inside the code and made some changes which are working properly, which offers much more options, more consistency and less code too.

      The result is the following. You have 3 Options for generating name and title, which could be combined in endless variations.
      Name is always derived from title, same like creating pages manually.
      type date: if function detects # character anywhere in the string, conversion will be: deletion of # and string will be used as format parameter for PHP date() function type field: if string is a fieldname of the parent page the value of this field will be used type string: if string doesn't fit to the 2 preceeding it will be taken as it is All parts (separated by comma) will be composed in the order of setting. You can use unlimited numbers of parts

      I made a pull request on github: https://github.com/ryancramerdesign/ProcessWire/pull/831

      Example screenshots

      Setting ...


      will result in


       
    • By kongondo
      FieldtypeRuntimeMarkup and InputfieldRuntimeMarkup
       
      Modules Directory: http://modules.processwire.com/modules/fieldtype-runtime-markup/
      GitHub: https://github.com/kongondo/FieldtypeRuntimeMarkup
       
      This module allows for custom markup to be dynamically (PHP) generated and output within a page's edit screen (in Admin).
       
      The value for the fieldtype is generated at runtime. No data is saved in the database. The accompanying InputfieldRuntimeMarkup is only used to render/display the markup in the page edit screen.
       
      The field's value is accessible from the ProcessWire API in the frontend like any other field, i.e. it has access to $page and $pages.
       
      The module was commissioned/sponsored by @Valan. Although there's certainly other ways to achieve what this module does, it offers a dynamic and flexible alternative to generating your own markup in a page's edit screen whilst also allowing access to that markup in the frontend. Thanks Valan!
       
      Warning/Consideration
      Although access to ProcessWire's Fields' admin pages is only available to Superusers, this Fieldtype will evaluate and run the custom PHP Code entered and saved in the field's settings (Details tab). Utmost care should therefore be taken in making sure your code does not perform any CRUD operations!! (unless of course that's intentional) The value for this fieldtype is generated at runtime and thus no data is stored in the database. This means that you cannot directly query a RuntimeMarkup field from $pages->find(). Usage and API
       
      Backend
      Enter your custom PHP snippet in the Details tab of your field (it is RECOMMENDED though that you use wireRenderFile() instead. See example below). Your code can be as simple or as complicated as you want as long as in the end you return a value that is not an array or an object or anything other than a string/integer.
       
      FieldtypeRuntimeMarkup has access to $page (the current page being edited/viewed) and $pages. 
       
      A very simple example.
      return 'Hello'; Simple example.
      return $page->title; Simple example with markup.
      return '<h2>' . $page->title . '</h2>'; Another simple example with markup.
      $out = '<h1>hello '; $out .= $page->title; $out .= '</h1>'; return $out; A more advanced example.
      $p = $pages->get('/about-us/')->child('sort=random'); return '<p>' . $p->title . '</p>'; An even more complex example.
      $str =''; if($page->name == 'about-us') { $p = $page->children->last(); $str = "<h2><a href='{$p->url}'>{$p->title}</a></h2>"; } else { $str = "<h2><a href='{$page->url}'>{$page->title}</a></h2>"; } return $str; Rather than type your code directly in the Details tab of the field, it is highly recommended that you placed all your code in an external file and call that file using the core wireRenderFile() method. Taking this approach means you will be able to edit your code in your favourite text editor. It also means you will be able to type more text without having to scroll. Editing the file is also easier than editing the field. To use this approach, simply do:
      return wireRenderFile('name-of-file');// file will be in /site/templates/ If using ProcessWire 3.x, you will need to use namespace as follows:
      return ProcessWire\wireRenderFile('name-of-file'); How to access the value of RuntimeMarkup in the frontend (our field is called 'runtime_markup')
       
      Access the field on the current page (just like any other field)
      echo $page->runtime_markup; Access the field on another page
      echo $pages->get('/about-us/')->runtime_markup; Screenshots
       
      Backend
       

       

       
      Frontend