Jump to content

Juergen

Members
  • Posts

    1,410
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Juergen

  1. 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.
  2. I can confirm this behavior but I must take a closer look to find out what is happening. 🤔I am always using POST and not GET in my forms, so I have not discovered this issue until now.
  3. Strange in my case it shows exactly the value that I have chosen before the form submission. Is this a simple select element or a select multiple in your case? Before submission: After submission As you can see the value "custom" is before and after the submission present.
  4. 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
  5. 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.
  6. 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
  7. 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
  8. @cwsoft you were absolutely right - this was the reason 😛
  9. 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.
  10. 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.
  11. 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.
  12. Hello @cwsoft No, I haven't, and I think it would work with SMTP, but as I already wrote, I want to use the standard mail function because it is more simple 😉
  13. 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
  14. 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
  15. Here is a live example of the comment module using UIKit 3 markup: https://www.schulfreund.at/nachhilfekurse/chemie-nachhilfe/
  16. 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!
  17. 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
  18. Hello @dynweb Thanks for reporting this issue. I have fixed the link now in the latest version 2.2.34. Best regards Jürgen
  19. Hello @Claus Thanks for confirming that the problem is solved now. Regarding to your new problem: This error message comes from the validator of the Valitron library which I use to validate form fields. This is an external library and not written by myself. This validator checks if the given email domain (fe gmail.com) exists. If not it throws an error, but it does not check if the full email address exists (fe myemail@gmail.com). I have tested it with one of my Gmail addresses locally and there was no problem, but this email address ends with "gmail.com". Do you use another Gmail domain than "gmail.com"? You can also send me the Gmail address which causes the error via PW because it is not recommended to post it here and I will test it on my site.
  20. If a user is logged in, than the email address will be pre-filled with the value from the user page of this user. This is the default behavior. If user is a guest, than the user has to fill out the email address manually. But it is not possible, that the email address from the configuration will be displayed in the email field. Please check this once more. If the problem persists after the update, you can send me screenshots of the issue via PM if you want.
  21. Hello @Claus Thanks for reporting this issue. There was a bug in the email validation method and I have fixed it now. Please update to the latest version 1.3.12 and everything should work as expected. Best regards Jürgen
  22. You have an eagle eye @PWaddict😀 I have fixed this issue now. If you have the latest version 2.2.33 installed, you need to replace the file https://github.com/juergenweb/FrontendForms/blob/main/FrontendForms.module. Otherwise you can update the module as usual and you are done.
  23. Hello @PWaddict I have added selectively loading of the JS and CSS files in the backend. To test it, you only need to replace the file https://github.com/juergenweb/FrontendForms/blob/main/FrontendForms.module once more. It contains now additional methods to check if the files should be loaded on the current page or not. It was not so easy, because the image picker files of FrontendForms will also be used by other modules from the FrontendForms family and I have to take care of it. Best regards
×
×
  • Create New...