-
Posts
1,306 -
Joined
-
Last visited
-
Days Won
13
Everything posted by Juergen
-
Hello @mayks I have installed the module and I have sent 2 mails with it (I have clicked the "Password forgotten" link to send me a mail, where I can change my password). From the statistic data, it seems to work (only the "Sent" will be displayed, but I guess this is because I have the trial plan). I have tested it only on the "Password forgotten" page, but at the first sight, it seems that only the mail object instantiation is a little bit different than like the WireMail, but all other methods are equal. I cannot promise at 100% that I will implement it and if so I do not know when I will find the time (not today and not tomorrow), but it seems not to be so complicated. I did not know this module or this mail service before and personally I will not use it, because I do not want to pay for it, but it could be interesting for users, who want a statistic. My idea: If I implement it, I would add a Select option inside the module configuration with the options "WireMail" and "Postmark", so you can select, which kind you want to use. Best regards Jürgen
-
Cross domain session problem in iframe [closed]
Juergen replied to Juergen's topic in General Support
I close this thread, because I use a hidden input field instead of a session! -
Hello @all I have a PW installation where a page contains a form, that uses a session for a CAPTCHA. Lets say this form is located on www.webpage1.com/myform. This form works without problems if I fill out the form directly on the given page. Now I have another website at www.webpage2.com. On this page I want to include the form from webpage1.com via iframe <iframe src="www.webpage1.com/myform" style="width:800px; height: 1000px;"></iframe> It loads the page with the form inside the iframe, but it seems that the sessions does not work anymore, because the form is located on another domain. To be more precious: The form contains a CAPTCHA and the value of the CAPTCHA is stored inside a session on webpage1. If I fill out the form inside the iframe on webpage2, the CAPTCHA does not work anylonger and throws always the error message that the value of the CAPTCHA entered in the inputfield is wrong. My question: How can I make sessions working in iframes too on crossdomains? I have googled, but did not found a good explanation how to achive this. Can someone help me out?
-
Hello @Flashmaster82 The new update could be interesting for you: https://processwire.com/talk/topic/26015-frontendforms-a-module-for-creating-and-validating-forms-on-the-frontend/?do=findComment&comment=238354 This update includes a new method for redirecting after form submission in an easy way. Use the setRedirectURL() method $form->setRedirectURL('www.google.com'); // enter the redirect URL inside the parenthesis This will redirect to another page/URL after successful form submission. No more need to add the redirect inside the isValid() method. Best regards
-
Update 2.1.56 This update comes with 2 fixes and 2 new methods. Missing declaration for property $toplabel of type Textelement inside InputCheckboxMultiple.php added Change CAPTCHA label for CAPTCHA validation message to fit better - PLEASE UPDATE YOUR LANGUAGE FILE FOR THE NEW TRANSLATION New method setRedirectURL() added: This method forces a redirect after the form has been validated and the code between the isValid() condition has been executed. This can be used to redirect fe to a "Thank you" page after a contact form has been submitted (read more). It does not matter in this case if you are submitting the form via Ajax or not. Therefore the old setRedirectWithAjax() method is no longer needed (but still works) New alias method useAjax() added: This method is an alias method for the existiting setSubmitWithAjax() method. The old method forces a form submission via Ajax. The name of the old method is too long, so I decided to create a method with a better and shorter name. So the old method still works, but for the future it will be better to use the new useAjax() method instead (read more). As always, please check if everything is working fine after the update!!
-
There is nothing wrong with your redirect, but in your case a better place for the redirect would be only after the mail has been sent (inside the if condition): if($m->send()){ wire('session')->redirect(wire('config')->urls->root . 'forfragan-skickades/'); } I have tested it on my site with a redirect to another page -> works without problems. There must be another problem with your system. Sometimes ProcessWire does unconventional things and struggles even all codes are OK. Closing the browser completely to delete all sessions would help in most cases (Reset). I have struggled sometimes with those problems during development of modules, where I am changing code, got errors and afterwards ProcessWire was a little bit out of control. Reseting it by closing and opening again is sometimes the best way. I am pretty sure that this was not the problem. My guess: Either it was the system problem as described above or you had a misspelling of your receiver email address (not the from address)
-
I am using Tracy and I can see if an Ajax call will be taken or not - in my case there is no Ajax call at all if I disable Ajax on per form base. So if there is no Ajax call on the home domain, then there is no Ajax call in the iframe. Please be sure to clear all caches and refresh modules (just to play safe). I have no explanation why the JavaScript code for the XHR request runs. Maybe caching problem?? Of course, you only need to add the redirect on the last line inside the isValid() method: $form->isValid(){ ... ... $session->redirect('path/to/my/page'); // or you can use an URL } No, it should work like other forms.
-
I guess that something stops the sending process, but without TracyDebugger we get no information whats going on. You can take a look into the log files if you find something. Another try would be to remove the creation of the page for testing purpose - let only the mail function inside the isValid() method and see what happens. The code seems to be OK
-
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.