-
Posts
1,394 -
Joined
-
Last visited
-
Days Won
17
Everything posted by Juergen
-
I am sorry, but I cannot understand what you mean?!? Post only a screenshot of the page with the form before you push the send button and afterwards. Please use the form with my code!! This is the code, what we are testing at the moment: $form = new \FrontendForms\Form('myForm'); $name = new \FrontendForms\InputText('lastname'); $name->setLabel('Last Name'); $name->setRule('required'); $form->add($name); $button = new \FrontendForms\Button('submit'); $button->setAttribute('value', 'Send'); $form->add($button); if($form->isValid()){ $m = wireMail(); $m->to('myemail@example.com'); // please change it $m->subject('Test message'); $m->bodyHTML('My body text'); if($m->send()){ print_r('send'); } }
-
This is not necessary!!! You misunderstand me completely! I do not want to know if the success message "Thank you for you message" will be printed out - I know that this will be printed out, but it has nothing to do with sending an email. It only gives you a message, that the form is validated correctly. I want to know if the word "sent" from the print_r() will be appear on the screen!!! BTW I have used a TracyDebugger function in my last code example. So this will not work if you have TracyDebugger not installed. Please use the code above with print_r('sent') and not bd('send'). Can you post a screenshot before and after the form has been submitted, so I can see what is going on on the screen?
-
Alternatively you can try this simple code to see if mail sending works: $form = new \FrontendForms\Form('myForm'); $name = new \FrontendForms\InputText('lastname'); $name->setLabel('Last Name'); $name->setRule('required'); $form->add($name); $button = new \FrontendForms\Button('submit'); $button->setAttribute('value', 'Send'); $form->add($button); if($form->isValid()){ $m = wireMail(); $m->to('myemail@example.com'); // please change it $m->subject('Test message'); $m->bodyHTML('My body text'); if($m->send()){ bd('send'); } } Please change the email address!!!!
-
No, only the pure PHP WireMail class which is included by default. There is no need to use an additional module. You have not answered my question: Does print_r() output anything?? It should return a number higher than 0; Please disable the redirect for this case!! Please check your email address once more, or try to use another email address. In the past I had a writing mistake in an email address and I have not found this mistake for a while. Do you have TracyDebugger installed?
-
No, the sending of emails is not part of the module, it is part of the ProcessWire WireMail class and has nothing to do with FrontendForms. I have only included 3 parameters (mail template, date format and time format) for sending mails and they have nothing to do with the sending process. Does print_r() output anything - this will be an important information!! Be sure that the receiver email address is written correctly, otherwise you will not get any mails!!
-
@herr rilke I have tried to submit a form inside an iframe on my localhost and it works with or without Ajax in my case. But I have to say that the form is on the same domain in this case: The form itself is located on the homepage and I have embedded it via iframe inside a childpage on the same domain. Unfortunatelly, I cannot test it on different domains. Please check if it works, if you embed the form on the same domain. Only to mention: The form, you will see in the image is another form and not the one that has been submitted (its from a new module, for creating comments based on FrontendForms).
-
Good morning @herr rilke To be honest, I have not tested the form submission inside an iframe before. If you are using an iframe, using Ajax is obsolete, because you will not get a page reload as far as I can remember (I have not used iframes for more than 10 years, so I am not 100% sure), because the form is embedded and not directly inside the code of the page. Please disable Ajax submission in this case and try it again. You can disable the Ajax on this form by using the following code: $form->setSubmitWithAjax(false); // can be true or false Let me know if it works now. Best regards
-
Hello @Flashmaster82 Your code seems to be OK. I have tested it (except the creation of the new page) and I received the mail as expected (tested on localhost with Xampp). Sometimes it will take some time, until the provider sends the mail to your inbox. You can also try the following: // replace $m->send() // with if($m->send()){ print_r('sent'); } If the mail has been sent, the print_r will be executed, so you can be for sure that the mail was sent successfully. If you do not receive anything the problem must be afterwards (fe mail configuration on your host,...)
-
Hello @Flashmaster82 Please copy this code to your template: $form = $modules->get('FrontendContact')->getForm(); // phone field $phone = new \FrontendForms\InputText('phone'); $phone->setLabel('Phone number'); $phone->setRule('numeric'); $phone->setRule('required'); // add this field after the name field $form->addAfter($phone, $form->getFormElementByName('surname')); $service = new \FrontendForms\Select('service'); $service->setLabel('Services'); $service->addOption('Service 1', 'service1'); $service->addOption('Service 2', 'service2'); $service->addOption('Service 3', 'service3'); $service->setRule('required'); $form->addBefore($service, $form->getFormElementByName('message')); echo $form->render();// Render the form I have disabled following forms in the backend configuration of this module, because they were not on your list: gender, subject and privacy. BTW, you have not written if the dropdown should be a single select or a multi-select, so I have chosen a single select. To position the custom form fields inside the form I have used the addBefore() and addAfter() method. You will find an explanation about using custom fields on GitHub. If you want to know, how you create custom fields you will find a lot of examples inside the repository of FrontendForms. Hope this helps!
-
The static method is not really the problem in this case, but the translateable functions (_(), _n()) inside the static method cause the issue as @donatas pointed out: But I need the translatable strings inside this method for the return statement, so I had to switch back to a non-static method. This was not the first problem with a Mac. I can remember at very early versions of this module, a user who uses a Mac had path problems, so he got a lot of errors that classes (or better the files) could not be found.
-
Thanks @donatas for sharing the log file with us. It contains not really useful information for me, but maybe other users can interpret the error message and what has been going on. As I can see, reverting the secondsToReadable() method from static to non-static was the safest step we could take to prevent the issue.
-
FrontendForms update 2.1.55 Bug fixed on min time configuration input field (name attribute was missing) Static function secondsToReadable() will be reverted to non-static. The static function leads to some problems under certain conditions, so the best way was to revert it back to non-static (read the discussion above). IMPORTANT: This has an impact on the FrontendLoginRegister module if you are using 2-factor-authentification, because this module uses the static function. If you are using the FrontendLoginRegister module, please update this module first (or at the same time with FrontendForms) to prevent problems. Thank you!
-
Thank you for your feedback!! That was a real struggle, but we get it ?! The only side effect is that I have to update one of my other modules (FrontendLoginRegister) too, because it uses the static method. Otherwise it will not work if 2-factor-authentification is enabled. So I have to add the same method to this module too to get it working flawlessly. To do now write the same method twice was the reason, why I have switched the method to static in the past. I will update the other module first and after that I will bump up the version of FrontendForms too. Cu
-
I have tried to find a possible cause for the problem by using a static method, but I did not find one. Maybe it will be caused by the _n() function of ProcessWire, which will be used inside this method (but this is only thought). Anyway, I have changed the method back to non-static. Could you please copy the code of the file below to your FormValidation.php FormValidation-new.php If it works for you, I will add it to GitHub and bump up the module version, so you can update the module as usual.
-
Glad that you figured it out!!! ? Usually, static methods are not others than non-static methods. The only difference is, that you do not have to instantiate a new object to be able to use it. Thats why I am a little bit confused that this may cause this error. ? I will try to find out what the problem is. I will inform you, after I have made some changes to the FormValidation.php, so that you can test it if it works.
-
What you could also try is to embed the form code directly inside the template instead of using an include. It should not have an impact, but who knows. This is what makes me thinking of that the problem should be caused by your local machine and not by the module itself. Something there (fe a specific configuration) causes this unwanted behavior.
-
I was so sure that the issue can be found in that file. ? These are the relevant files, that have been changed: Form.php FormValidation.php FrontendForms.module frontendforms.js Could you try to change the Form.php and the FrontendForms.module files to the version of 2.1.46 and leave all other files untouched. If the error persists please do the same with FormValidation.php and if necessary with the frontendforms.js, so that all 4 files are from version 2.1.46 at the end. Do not enable Captcha or Ajax. Does TracyDebugger not throw an error messages at all? What you can also do is to take a look at the browser console (Short cut F12) to take a lookt fe at the response header code (status code).
-
This is very strange! I guess the only place for a problem could the form.php file in this case, because it contains all the code for the frontend. I have studied the differences between the code from version 2.1.46 and 2.1.47 from the Form.php file, but I have not found a line, where I think it could be the cause for this issue. Here you will see the differences between the 2 versions: https://github.com/juergenweb/FrontendForms/commit/c42a410c247dd04bb296a04d8e112dc8fbb7dc4b If you have time, please change only the code of the Form.php file from the current version (or the 2.1.47) version with the one of the 2.1.46 version. Leave all other files untouched. If it works, we could be for sure that the problem is really inside the Form.php and nothing else. I have tried to change the codes and I did not run into problems (current version of FrontendForms, but Form.php was from the 2.1.46 version). form-2.1.46.php You can use your own 2.1.46 file or you copy the code from this file. Please let me know if the problem still persists.