-
Posts
1,390 -
Joined
-
Last visited
-
Days Won
17
Everything posted by Juergen
-
Ok, I found the cause for the white page: The CSRF validation is responsible for it. Fast fix: Please replace the this line inside the Form.php inside the isValid() method with this line if((strtolower($this->getAttribute('method')) === 'get') || $validation->checkCSRFAttack($this->getCSRFProtection())){ This disables the CSRF validation if GET is chosen as the method. This is only a fast fix to get it working, but I must dive a little deeper to find out why the CSRF session always returns false in this case.
-
Of course, there are several options. Which one you should use depends on your preferred output. 1) Wrap multiple inputfields inside a fieldset Take a look here for more information or here for a working example. Sometimes a fieldset is the best option to wrap some inputfields syntactically correct. 2) Wrap multiple inputfields within a div container by using the append() and prepend() methods Take a look here for more information and here is an example using this methods. If you want to wrap for example 4 inputfields inside an extra div container, the idea is to add the opening div tag via the prepend method to the fist field and the closing div tag via the append() method to the last input field. 3) Use the setMarkUp() method to add the opening and closing div I think this is the most practicable method for you if you do not want to use a fieldset. You will find more information here. Example for wrapping multiple fields between 2 div tags: $markup = new Markup(); $markup->setMarkup('<div>'); // opening div $form->add($markup); // here enter your inputfields .... .... $markup = new Markup(); $markup->setMarkup('</div>'); // closing div $form->add($markup); Best regards
-
Then try the following: if (!is_null($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], $this->wire('config')->urls->admin) === 0) { Have not tried it with bootstrapping but the code inside the if condition is not important for running forms. It is only there to add CSS and JS files to the backend, so you can prevent the running of the code inside the condition by checking the existence of $_SERVER['REQUEST_URI'] first.
-
This issue has nothing to do with the module itself, but it seems that the $_SERVER array is not loaded at that moment. You can try the following: // Replace the following line inside the FrontendForms.module file on line 858 if (strpos($_SERVER['REQUEST_URI'], $this->wire('config')->urls->admin) === 0) { with this line if (!is_null($_SERVER) && strpos($_SERVER['REQUEST_URI'], $this->wire('config')->urls->admin) === 0) { Let me know if it works
-
Hello @da² You are absolutely right. The cause was a missing second parameter inside the filename sanitizer. I have fixed it now, so please download the corrected Form.php file from Github and replace it with the one on your local installation. If everything works as expected I will update the module version. So please test it and give me a feedback if everything is ok now. Best regards Jürgen
-
Here is the solution for this scenario: Instead of using only the "from" property, use the "replyTo" property too. 1) Use a sender email address that contains your domain instead of the actual sender address (for example use norply@mydomain.com, where mydomain.com is your site domain. $mail->from('noreply@mydomain.com'); 2) Add the actual sender address (for example john@gmail.com) to the replyTo property $mail->replyTo('john@gmail.com'); This will use the mail address of the actual user if you click on reply instead of "noreply@mydomain.com". I will add this to the module in the next update, so it should work on every host.
-
I have found the cause for this strange behavior: This is specific to my hoster world4you.com, but the problem could occur on other hosters too. My hoster does not allow you to send mails from domains other than the website domain itself. For example: My domain is www.mysite.eu, then I can only send mails where the email address ends with the domain name (e.g. myemail@mysite.eu). When I try to send an email from a different email domain (e.g. gmail.com), the email is not sent. I have not found the solution to disable this behavior, so I must contact my Provider. I guess this could be a security feature of the provider.
-
No, but I think there must be another cause than I have thought first. The strange thing is that I can send mails by using 2 of my modules with the WireMail class without problems on that host. Only the third module makes problems. I have solved this problem for now by using the WireMailSmtp module.
-
Hello at all I encountered a strange issue when sending emails using the Wiremail class from a shared host (world4you.com). Short description of the problem I added the following code from the documentation for the WireMail class to one of my templates for testing purposes: $m = $mail->new(); $m->to('myemailadress@example.at') // will be replaced with my real mail addy ->from('testmail@test.at') ->subject('Message Subject') ->body('Optional message body in plain text') ->bodyHTML('<html><body><p>Optional message body in HTML</p></body></html>') ->send(); After loading a page with this template, the email should be sent to my email address, but I never receive an email. If I use the same code on my local Installation with XAMPP using Gmail as my mail Client everything works as expected. So I tried to figure out where the problem might be, and I discovered the following: The WireMail class contains the send() method, which is responsible for sending the email. There you will find the PHP mail function, which contains a header variable ($header). If I remove this header variable from the brackets, the email is sent; otherwise, it is not. But the email content will not be displayed properly without this header variable. Before removing the header variable: if(@mail($to, $subject, $body, $header)) $numSent++; After: if(@mail($to, $subject, $body)) $numSent++; The problem could therefore be due to an incorrect header. So I took a look at the function renderMailHeader() which is responsible for creating the mail header syntax. I found out that the email is only sent if the value of “From” in the header is enclosed in double quotation marks, otherwise it will not be sent (see figure below). This does not seem to be important on my local installation. By default, the "From" value (in this case "myemail@example.com) is not between quotes in the header. If I change this inside the renderMailHeader() function, the mail will be sent. Only to mention: There is no entry in the log files indicating that something went wrong. Does anyone else have the same problem on a shared host and know how to fix it? I don't want to use SMTP instead, though. I guess there must be a better solution than changing something in the code or the problem is not the header syntax. Perhaps the header is not the problem, but rather the problem is related to something else?!? Thanks in advance for your help and hints
-
Hello @gloser Glad to hear that you use FrontendForms!! If you create the form by yourself as a standalone it will not work, because the $form->render() method is connected to the isValid() method. This is the place where all the magic happens. To create the desired ouptut you will need to manipulate the form markup by using some manipulations-methods. Each element of a form is an object and can be manipulated in different ways. As I can see you are using Bootstrap as your prefered CSS framework. I will try to help you to get the desired output. For this reason it would be great if you post the code of the form here in the forum or alternatively you can send me the the code via PM. Then I have a starting point where I can add the necessary manipulations. Best regards Jürgen
-
Here is a live example of the comment module using UIKit 3 markup: https://www.schulfreund.at/nachhilfekurse/chemie-nachhilfe/
- 1 reply
-
- 1
-
-
This module is a remake of Ryan's classic Comments module, but uses its own code and is based on the FrontendForms module. This is the third module in the "Frontend" series, alongside the FrontendContact and FrontendLoginRegister modules. To use this module, FrontendForms must be installed. Otherwise, it won't work! If you don't have this module installed yet, please download and install it first! This module has a large amount of configuration settings supports pagination supports UiKit3, Boostrap 5 and Pico 2 CSS frameworks out of the box and a lot more The download link as well as many more images and the documentation for this module can be found on Github. Please note: This is the first version in an early alpha stage, so using it on live sites is not recommended. This module should be available in the module directory eventually, but it still needs a lot of testing. If you discover any issues or have ideas for improving the module, please post them here in the forum or directly on Github. Happy testing!
- 1 reply
-
- 10
-
-
Hello @dynweb Thanks for pointing out this issue. To be honest, I have never thought of such a possibility, because I always wanted to output a feedback message after the form submission. Your contribution leads me to update the setSuccessMsg() and setErrorMsg() methods to accept boolean values too. So if you want to disable the output of one of them please add false inside the parenthesis. These prevents the output of a message after form submission. $form->setSuccessMsg(false); This is more elegant than adding an empty string, but you need to replace the following file from Github with yours: https://github.com/juergenweb/FrontendForms/blob/main/Formelements/Form.php This addition will be automatically included in the next update, but I do not want to update the module today. You will find more infos about the new additions inside the changelog.md. Best regards Jürgen