-
Posts
1,421 -
Joined
-
Last visited
-
Days Won
18
Juergen last won the day on November 24 2025
Juergen had the most liked content!
Profile Information
-
Gender
Male
-
Location
Linz
-
Interests
Playing electric guitar (Rock, Heavy), flying model helicopters
Juergen's Achievements
-
Hello @da² I have added a new validation rule that could be interesting for your usecase: uniquestringvalueofpwfield It checks for the uniqueness of a value inside of a specific ProcessWire field. Lets assume you have stored your gaming usernames inside the PW field with the name "gamer_name" which you have added to the user template. Then you could validate the gaming username with the new validator like this: $gamername = new \FrontendForms\InputText('gamername'); $gamername->setLabel('Gamer name'); $gamername->setRule('required')->setCustomFieldName('This gamer name'); $gamername->setRule('uniqueStringValueOfPWField', 'gamer_name', ['user']); $form->add($gamername); As you can see, you have to add the name of the PW-field (= gamer_name) as the first parameter. The second parameter (= the name of the template") is not mandatory, but it makes sense in this case to restrict the search only for entries in the user template. Add this as an array, because it also possible to search in multiple templates). Otherwise the search will be globally on all templates where this ProcessWire field is added. To use the new validator please update to 2.2.13 Best regards Jürgen
-
Hello @da² looks like it is not so difficult 🙂. First of all I would take a look at the following Inputfield: https://processwire.com/modules/fieldtype-text-unique/ This looks interesting and if it fits to your needs, than add it to the user template in the backend as the field containing the gamer name. Second, take a look at the uniqueEmail or uniqueUsername validators, which are already included in FrontendForms. These validators could be used as a starting point for your own validation rule. Take them as an example to create your own custom rule for gaming names.
-
After taking a look at the code, I guess the best approach would be to go with a custom validation rule, because there is so much going on inside the isValid() function that must be checked in the setErrorMessageToField() method too. Can you explain which kind of validation you need in this case. Maybe I can help you to create the custom rule. You can also send me a PM with the code you have so far.
-
This is caused by the TracyDebugger - I have forgotten to remove this call after Debugging. Please go to the Form.php and find the following line and remove it: bd($this->formErrors); Then this error will be gone. I have removed the TracyCall on Github too. This is strange, because it has nothing to do with the PHP code. Please take a look at your CSS classes. On my site the color is white. Yes, this is a browser security behavior and independent which browser you will use - file upload fields will always be empty after submission (whether successfully or not). I will test it with file upload fields and see if I can reproduce the issues. For now, please remove the bd() call first.
-
Yes, that is the purpose of this variable: To add additional values to the validator. You can add several values as an array to the validator. To get a specific value from this array, you only have call it by its key (fe $params[2] will return the array value on the position with the key 2). You will find a lot of examples on how to write custom rules inside the CustomRules.php file. There you can study how to use the $params variable to test conditions with it.
-
Hello @da² I have added a new method to trigger an error message to a field manually: setErrorMessageToField() Here is a small example on how to use it: $form = new \FrontendForms\Form('testform'); $form->setMaxAttempts(0); $form->setMaxTime(0); $form->setMinTime(0); $firstname = new \FrontendForms\InputText('firstname'); $firstname->setLabel('Firstname'); $firstname->setRule('required')->setCustomFieldName('The first name'); $form->add($firstname); $button = new \FrontendForms\Button('submit'); $button->setAttribute('value', 'Send'); $form->add($button); if ($form->isValid()) { $form->setErrorMessageToField($firstname, 'This is my custom message'); } echo $form->render(); If the "default validation" was successful, then the error message will be displayed under the "firstname" field in this case. You can use it to make another validations inside the isValid() function to check the submitted form values against other conditions. If the conditions fail then you can output this manually triggered error message like written above. To use the new method, you have to replace the file site\modules\FrontendForms\Formelements\Form.php with the one from Github or you simply add the new function to your Form.php. Please let me know if this helps.
-
Hello @grewr11 Thanks for pointing out this issue. I have removed the sanitizer for names on the "Name" field, because usernames are allowed to have numbers in it. This was a thinking mistake. Now it should work as expected. Please replace the following file to get it working: https://github.com/juergenweb/FrontendComments/blob/main/FrontendCommentForm.php I have discovered another issue, with WireMail and localhost, so please replace the following file too: https://github.com/juergenweb/FrontendComments/blob/main/Notifications.php You will find all information about the changes in the changelog.md. I haven't worked on this module in a long time, so there could be more problems. Please report any problems, I will try to solve them as soon as possible. Jürgen
-
Hello @ttbb I have tried to reproduce the issue you had described, but in my case everything works as expected. I have used Bootstrap 5 and 2 contact forms side by side using the "row" and "col" classes. This works as expected as long as the errors are form errors (wrong or missing input data). But I have discovered an issue by showing the alert box if the form has been submitted too fast. In this case it did not jump to the top of the form properly to show the alert box that informs the user that the form has been submitted too fast. Therefore I have made some changes to make this work properly. Take a look here at the changelog file. So please update to the latest version 2.3.11 and let me know if there are some problems left. Best regards Jürgen
-
Hello @ttbb This should work by default 😐, so there is no need to add it to the JS manually. To be more specific: If a form submission is successful or has errors, than the page jumps to the start of the form (not to the top as you have written), so the user can see the success or the error message (independent of the length of the form). This should work with or without AJAX. If it does not work in your case, please post your form code here or send it to me via PM and I will test it. Best regards Jürgen
-
This module is nothing special. It adds a small JavaScript and CSS file to your page to create a nice snowfall. To adapt the snowfall to your needs you have some configuration options like snowfall density, min and max size of the snowflakes, duration time of the snowflakes and more. You have the option to start and stop the snowfall manually or depending on the date. At the moment you will find a live example here: https://www.schulfreund.at/ This example is only active in the winter season - not the whole year 😉 You can find the full docs and description and the download possibility of the module here. Have fun and enjoy the winter!!
- 3 replies
-
- 11
-
-
Hello @ all The new version 2.3.0 comes with a brand new feature: the possibility to turn a form into a multi-step form. Many thanks to @Jan S. for the idea and the support in testing during the development of the new feature. In a nutshell: A multi-step form is a long form divided into multiple steps. At the end of each step, the user clicks on a "Next" button to go to the next section. In the final step a summary of the data entered will be displayed to the user. The user now has the option to change some of the data if necessary before finally submitting the form. Typical use cases are very long forms, surveys or quizzes. I have written an extra chapter in the docs with a lot more information, which you can find here. There are only 2 restrictions for multi-step forms to work properly: The send button must be after the last step (by the way, it wouldn't make sense to put it anywhere in between ;-)) File upload fields must be placed in the last step (otherwise they won't work) To turn a form into a multi-step form, you only need one new method: addStep() You need to add this method to the form object in the places where you want to make the cut: $form = new \FrontendForms\Form('simpleform'); $firstname = new \FrontendForms\InputText('firstname'); $firstname->setLabel('Firstname'); $firstname->setRule('required'); $form->add($firstname); $lastname = new \FrontendForms\InputText('lastname'); $lastname->setLabel('Lastname'); $lastname->setRule('required'); $form->add($lastname); $form->addStep(); // first step $email = new \FrontendForms\InputEmail('email'); $email->setLabel('Input Email'); $email->setRule('required'); $form->add($email); $form->addStep(); // second step $birthday = new \FrontendForms\InputDate('date'); $birthday ->setLabel('Birthday'); $form->add($birthday ); $form->addStep(); // third step $message = new \FrontendForms\Textarea('message'); $message->setLabel('My message'); $form->add($message); $form->addStep(); // fourth step $button = new \FrontendForms\Button('submit'); $button->setAttribute('value', 'Send'); $form->add($button); if($form->isValid()){ print_r($form->getValues()); // do what you want } // render the form echo $form->render(); That is all! You can find more examples here. To be informed of all the changes in this release, please read the changelog. As always, please keep an eye on whether everything is working as expected and report any issues you discover here or directly on GitHub. Jürgen