Jump to content

Juergen

Members
  • Posts

    1,221
  • Joined

  • Last visited

  • Days Won

    10

Posts posted by Juergen

  1. Good Morning @PavelRadvan

    Now I have tested the latest FrontendForms with the latest dev PW version on a  live test server after upgrading to PHP 8.3.1 and in my case it works without problems.

    phptest.thumb.jpg.4c9b4a0406e83cf40bc90de5a1353b39.jpg

    So I can confirem, that there is no problem using FrontenForms with PHP 8.3.1. Maybe your problems are caused by a misconfiguration of the server? But without getting error messages it is difficult to trace the problem to its source. I use it on a shared host and I do not make any changes to the server (and I am not an expert at servers).

    Best regards Jürgen

  2. Thats a very strange behavior 🙄 Are there some errore messages inside the logfiles of PW (maybe a time setout message)...

    I have no idea, what the cause could be. As you write, this happens directly after you are trying to go to the settings page of the module..... but the only process, that runs in this case is the rendering process. So there must be something the stops this rendering process of the setting form.

    Maybe it could have something to do with PHP 8.3 because PHP Storm complains about not declared variables inside the setting form for the module. The point is that the creation of the setting form of a module is done via PW API functions and therefore I do not have an influence here.

    Please check your log files if something has been stored there. On the weekend I transfer a website to a server who uses 8.3. I will check this out to see if some problems occur.

  3. Hello @PavelRadvan

    Thanks for your info at first. I have not discovered problems like this til now and I guess other users do not run into problems like this too. Otherwise someone has informed me about such a behavior.

    I only run this module on PHP 8.1, but there I have no problems at all. The code should run on 8.3 too, but I have only tested the syntax on PHP-Storm and not in live situation - so the code should be valid for PHP 8.3 too.

    Some question:

    Does the problem consist on every page request?

    Do you have tried to close all browser windows and open the website after that again (sometimes PW runs into performance issues, with an unknown issue and after "re-start" everything works as expected)?

    Does this problem persists if you are calling only the backend (without forms output on the frontend).

    Maybe you could give me some infos about that.

    Best regards Jürgen

     

     

  4. Hello @Flashmaster82

    2 hours ago, Flashmaster82 said:
    // Email
    $email = new \FrontendForms\InputText('scf_email');
    $email->setLabel($fields->get('scf_email')->$label);
    $email->setRule('required');
    $form->add($email);

    You have only added the required Validator. There are a lot of examples inside the examples folder how to validate an email address (fe at the contact forms).

    In this folder you will also find a special file with a lot of validation examples: https://github.com/juergenweb/FrontendForms/blob/main/Examples/field-validation.php. This file contains examples of (nearly) all possible validators and how to add them to an input field.

    There are 2 special validators for validation of an email, which are interesting for you:

     

    In the next steps I will show you 3 possibilities (option) how to validate an email field.

    Option 1: Add the additional email validators to your code example

    // Email
    $email = new \FrontendForms\InputText('scf_email');
    $email->setLabel($fields->get('scf_email')->$label);
    $email->setRule('required');
    $email->setRule('email'); // checks for the right syntax of the email
    $email->setRule('emailDNS'); // optional: checks if the email has a valid DNS record
    $form->add($email);

    This works, but it is not the recommended way for emails. You have used an InputText input field, but for emails there is a special input field, which includes the mentioned validators by default: InputEmail

    Option 2: Instead of using InputText, it is better to use InputEmail, which includes email valdiation by default

    // Email
    $email = new \FrontendForms\InputEmail('scf_email'); // make usage of InputEmail 
    $email->setLabel($fields->get('scf_email')->$label);
    $email->setRule('required');
    $form->add($email);

    As the last option, I want to show you a pre-defined email input. To simplify life, I have created pre-defined input field types for the most used form fields, like surename, lastname, email, message and so on. You will find all this pre-defined fields inside the defaulf folder.

    These default fields includes validators and labels for these inputfields and the code is very short.

    Option 3: This code includes all email validators and the pre-defined email label - it is the shortest version.

    // Email
    $email = new \FrontendForms\Email('scf_email');
    $email->setRule('required');
    $form->add($email);

    Now you have 3 options, where you can choose from.

    Best regards Jürgen

    • Like 1
  5. Nevermind @mayks!

    I hope it works as expected, because I do not use Postmark and therefore I have only tested the base function (sending process). Please take care that only 1 external mail module is installed, otherwise you will run into problems, but this is not a module related issue, it is an PW issue. In this case PW takes always the first external module in line and ignores all others (independent of you settings inside this module config).

    • Thanks 1
  6. Hello @bernhard

    12 minutes ago, bernhard said:

    I think the reason why the language is always the default one is because the hook adds to an URL that looks like the default language in PW - which makes sense.

    This seems to me also as the most possible reason for this behavior. BTW, I was not confronted with this issue since then, but thank you for reporting an issue at GitHub and for the information.

    Have a nice day!

  7. Version 1.2.0 ist out!

    This version supports mail sending with Postmark mail sending service.

    Read the full changelog.md for more information about Postmark and what has been changed.

    If you have one of the Postmark modules as mentioned in the changelog installed, you will find a new configuration field inside the module configuration.

    postmark.thumb.jpg.cf86da38e2a3edd27fb268273662bf1f.jpg

    Here you can select if you want to send your mails with Postmark or not. Selecting "none" means using the default WireMail class for sending mails.

    In order to work properly, you will need at least FrontendForms 2.1.57 installed (as mentiond in the changelog.md).

    As always, this is Beta-status, so please take care that everything works as expected.

    Happy testing! 😃

    Jürgen

  8. Version 1.3.0 ist out!

    This version supports mail sending with Postmark mail sending service.

    Read the full changelog.md for more information about Postmark and what has been changed.

    If you have one of the Postmark modules as mentioned in the changelog installed, you will find a new configuration field inside the module configuration.

    postmark.thumb.jpg.cf86da38e2a3edd27fb268273662bf1f.jpg

    Here you can select if you want to send your mails with Postmark or not. Selecting "none" means using the default WireMail class for sending mails.

    In order to work properly, you will need at least FrontendForms 2.1.57 installed (as mentiond in the changelog.md).

    As always, this is Beta-status, so please take care that everything works as expected.

    Happy testing! 😃

    Jürgen

    • Like 1
  9. @ngrmm

    Please update to 2.1.58 - this version should fix your problems.

    Please add the new validator to your fileupload field:

    $fileuploads->setRule('uniqueFilenameInDir', true);

    The following method

    $form->getValue('fileuploads') 

    should now show the sanitized and/or overwritten filenames as well.

    The full explanation of the additions can be read here in the Changelogs.

     

    As always, please take care if everything works as expected after the update!! 🙂

     

     

    • Thanks 1
  10. Hello @ngrmm

    Interesting aspect I have not thought of before 🙄!

    I am afraid, but there is no inbuilt method to prevent this.

    I am thinking of a creating a new validator (fe uniqueFilename) to check if there is a file with the same name present inside the given directory. If so the validator should throw an error.

    Maybe another possibility would be to add a new method to the file upload class (fe $field->renameDuplicates()), which renames duplicates by adding fe a number after the filename (fe. filename, filename-1, filename-2,...)

    What do you think?

     

    • Like 1
  11. Good Morning @ngrmm

    By default, the file upload field takes care about your max upload file size value that has been set inside your php.ini (server config file).

    https://www.php.net/manual/en/configuration.file.php

    2048 is the max file upload size as set inside your php.ini in this case.

    You can disable this behavior by adding the following rule to your file input field:

    $file1->removeRule('phpIniFilesize');

    This disables the check of the php.ini max file size and you will get the desired result, but it is not the recommended way. If you have access to your server php.ini file, make your changes there and set a higher value for the max upload file size.

    If you have a local installation (fe. Xampp), you can change it by yourself, if you have a site on a shared host, maybe you will need to contact the server admin, if he can change the max. value for file uploads or you can login to your account and make your changes there.

    Hope this helps

    • Like 1
  12. 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).

    image.thumb.png.87c0c929c49e7599bcf72d56fd12371a.png

    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

     

  13. 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?

  14. 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

    On 1/6/2024 at 9:45 PM, Flashmaster82 said:

    I´m facing a new problem though.. I can´t get it to redirect after sending?

    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

    • Like 1
  15. 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!!

    • Like 1
  16. 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.

    10 hours ago, Flashmaster82 said:

    I think the problem was $m->from('noreply@...'); but im not sure.

    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)

    • Like 1
  17. 38 minutes ago, herr rilke said:

    is there a way to be sure to quit ajax calls?

    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??

    41 minutes ago, herr rilke said:

    can i set a page to redirect to after form submission?

    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
    }

     

    44 minutes ago, herr rilke said:

    that's why i wonder if your module could handle things differently than the software before.

    No, it should work like other forms.

×
×
  • Create New...