- 
                
Posts
1,407 - 
                
Joined
 - 
                
Last visited
 - 
                
Days Won
17 
Everything posted by Juergen
- 
	Hello @PWaddict It is/should be stable. This module is online for a long time, and there were no problems reported in the past - so it should work without problems. I have deleted the misleading text in the module description. I have not done it in this way before, but it should work without activation links. The only thing you have to take care is that you have to to save the activation datetime during you have created the new user. As you can see in the code below, the user field for the activation time is called "fl_activationdatetime". $user->fl_activationdatetime = time(); This should work, but test it by yourself. Best regards
 - 
	Hello @BigRed Ensure your website includes links to the login and/or registration page. These links aren't created by default, but some templates (like the UIKIT3 template) support this in their navigation functionality. Therefore, if you don't have links on your website (e.g., within a navigation) pointing to the page(s) that use the login and/or registration template, please create them by yourself. Then you can log in/register as usual. Best regards
 - 
	No, this could not be a reason, because you are also using these lines of code to manipulate the classes: $checkbox->getFieldWrapper()->setAttributes(['data-uk-grid', 'class' => 'uk-grid-small']); $checkbox->getLabel()->wrap()->setAttribute('class', 'uk-width-expand'); This methods are working in the same way as the getErrorMessage() method. I cannot tell you, why getFieldWrapper() and getLabel() works, but getErrorMessage() not. As written before, in my case everything works as expected. If you cannot find the cause, please use the hook method to get your desired result.
 - 
	Here is my ouput from the source code: <div class="uk-margin uk-grid-small error uk-grid" data-uk-grid="data-uk-grid" id="test-checkbox-fieldwrapper"> <div class="uk-width-auto uk-first-column"> <input id="test-checkbox" name="test-checkbox" type="checkbox" class="uk-checkbox uk-form-danger" required="" aria-invalid="true" aria- errormessage="test-checkbox-errormsg"> </div> <div class="uk-width-expand"> <label class="uk-form-label required" for="test-checkbox">My Checkbox Label<span class="asterisk">*</span></label> </div> <p class="uk-text-danger uk-width-1-1 uk-grid-margin uk-first-column" id="test-checkbox-errormsg">My custom required text</p> </div> As you can see the class "uk-width-1-1" is set on the error text.
 - 
	Are you sure? I have tested it on my site and it works as expected: $checkbox = new \FrontendForms\InputCheckbox('checkbox'); $checkbox->setLabel('My Checkbox Label'); $checkbox->setRule('required')->setCustomMessage('My custom required text'); $checkbox->getFieldWrapper()->setAttributes(['data-uk-grid', 'class' => 'uk-grid-small']); $checkbox->prepend('<div class="uk-width-auto">'); $checkbox->append('</div>'); $checkbox->getLabel()->wrap()->setAttribute('class', 'uk-width-expand'); $checkbox->getErrorMessage()->setAttribute('class', 'uk-width-1-1'); $form->add($checkbox); Do you have removed the hook?
 - 
	Take a look at the form field class file (https://github.com/juergenweb/FrontendForms/blob/main/Formelements/Inputelements/Inputfields.php). There you can see that an inputfield consists of various parts (wrappers, label, error message, success message, description, notes,..) Every element can be grabed an manipulated via a get....() function getLabel() getErrorMessage() getSuccessMessage() getDescription() getNotes() getInputWrapper() getFieldWrapper() Maybe this is not well documented inside the docs, but now you know it 😉
 - 
	Hello @PWaddict You are absolutely right - the position change will not taken into account. I have fixed this now. Please replace the following file: https://github.com/juergenweb/FrontendForms/blob/main/Formelements/Inputelements/Inputfields.php After that the position change should work, but please give me a feedback if everything works now as expected. After that I will bump up the version of FrontendForms. To get the desired markup, you have to do something like this: $form = new \FrontendForms\Form('inputfieldtest'); $form->setMinTime(0); $form->setMaxTime(0); $form->setMaxAttempts(0); $form->setErrorMsg('Ouups! There are some errors.'); $form->setSuccessMsg('Congratulation! There are no errors.'); $form->appendLabelOnCheckboxes(true); // set it here to true or in the backend config // add checkbox $checkbox = new \FrontendForms\InputCheckbox("checkbox"); $checkbox->setLabel("Checkbox Label"); $checkbox->getFieldWrapper()->setAttribute('class', 'uk-grid-small'); $checkbox->prepend('<div class="uk-width-auto">'); // add div before the input $checkbox->append('</div>'); // add closing div after the input $checkbox->getLabel()->removeAttribute('class')->wrap()->setAttribute('class', 'uk-width-expand'); // wrap the label element $form->add($checkbox); $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(); Take a look at the checkbox element. I have done some manipulations to add some classes and extra divs. I guess you are using the UIKit markup and if so, I think you also have to add the data-uk-grid attribute to the form if you are using grids (but not sure). I think you can image how it could be done to get the desired markup at all. If you have problems, please post the complete code for the form . Best regards
 - 
	Hello @MarkE The issue you reported sounds a little strange. I have tested it on localhost and on a live site, with the module installed and not, but I cannot reproduce this issue. On localhost: On a live site: As you can see, there is no difference between localhost and the live site. I was logged in as a superuser and as a manager. The manager role allows me to add new pages. There is no difference whether the module is installed or not (both on the live site and on localhost). Therefore there must be another reason for the behavior. I'm guessing you have different permissions for your roles on the development and live site. The module does not include a hook that affects the Save and Publish button on an admin page. Therefore, the module is unlikely to cause such an issue. The publishing of the pages works as expected too. I am sorry, but I guess you need to check if your roles or your template permissions could be responsible for your issue. Jürgen
 - 
	Ok, thanks!! I will mark this as solved - mmhh, sorry it is not possible 😂
 - 
	Hello at all! From time to time I get mails from the PW forum that I should mark a solved topic that I have started in the past with the "Mark as solution" button when the question asked has been answered . Did any of these replies answer your question? There may be more replies than those shown here. Help others by going to the topic and use the 'Mark as Solution’ button on the post with the best answer Stop receiving these reminder emails. — ProcessWire Support Forums Does anyone know, where this button should be? I cannot find it next to a post (even if I am logged in). Maybe someone can tell me. Thanks
 - 
	Hello @Frank Vèssia Thanks for reporting this issue. Unfortunately I cannot reproduce this error in my console. size() and length should return the same. Take a look at this discussion. Could you please replace the size() function with length to see if the error is gone now. If so, I can replace it on Github too, because it should not have a negative side effect. Thanks Jürgen
 - 
	Hello @Andy I have added your rule as the first community provided validation rule to FrontendForms. Take a look here. This validation rule is included in the next update, but if you do not want to wait until the next update, you only have to replace the code of the CustomRules.php from Github with yours and you are done.
 - 
	Hello @Andy I will write a new section in the docs in the next time about this possibility. Please note: If you want to use API variables inside your custom validation rule I guess you need to add this rule to the site/ready.php instead of the site/init.php. I have not tested it, but I guess you need to do it this way, but you can try it out. That is a good idea and if a validation rule seems to be useful for others I will add it to the FrontendForms validation rules file, so everyone can use it. I guess there are around 60 validation rules available at the moment, but more is more in this case. 😉
 - 
	Good news @Andy I have taken a look at the Valitron library, which I use to validate form fields and this library offers an easy to use solution to add custom rules. Take a look here. To add a custom rule to ProcessWire you need to add it to the site/init.php. For demonstration puroses I use the example from the Valitron docs. So please add this code (which always returns false) to your site/init.php \Valitron\Validator::addRule('alwaysFail', function($field, $value, array $params, array $fields) { // here you can write your validation code - this should return true or false return false; }, 'Everything you enter is not correct. You fail.'); Now you have added a new custom rule, which you can use sitewide like all other validation rules. Here is a form example containing this rule: $form = new \FrontendForms\Form('test'); $inputText = new \FrontendForms\InputText('text'); $inputText->setLabel('Input Text'); $inputText->setRule('required'); $inputText->setRule('alwaysFail'); // here is the new validation rule $form->add($inputText); $button = new \FrontendForms\Button('submit'); $button->setAttribute('value', 'Send'); $form->add($button); if ($form->isValid()) { } echo $form->render(); If you validate the form, you will always get the error message "Everything you enter is not correct. You fail." because this rule always returns false. You can take this example as a starting point for your own validation rule. The validation code must return a boolean value (true or false). Hope this helps
 - 
	Hello @Andy I will take your issue as an idea for a new feature and I will take a look if I could find a good working solution. At the moment I will wait if there are some unwanted negative side effects concerning the last update. If everything works as expected and no issues occur/will be reported I will go on to the next step and try to find a solution to your issue. Best regards
 - 
	I have updated FrontendForms to support hooks to customize the markup of certain elements. As written in a the blog post above there was a problem of using hooks, because they never fired. This should be solved now. You will find a working example on this website. If you press submit without filling out the form, all error messages will get an exclamation sign in front of the error message. This is done via the following hook inside the site/init.php: $wire->addHookAfter('Errormessage::render', function(HookEvent $event) { $msg = $event->object; $errorText = $msg->getText(); if($errorText){ $fontAwesome = '⚠ '; $event->return = $fontAwesome.$errorText; } }); This is for demonstration puropose that it works now! In addition I have added some other hook examples inside the Hooking section of the docs. This bug fix includes the change of really a lot of files of FrontendForms, so please that care that everything works after the update as expected. Make a backup before you update the module!!! Best regards
 - 
	The form will be always submitted after pressing the send button 😉 You have the choice, what should be done inside the isValid() function. This method returns always true if the "standard validation does not fail". It is up to you to make another validation inside the isValid() method, but there is no possibility to make isValid to false manually. As I explained in the example some post before, you can do addtional checks inside the isValid() method. Depending on the results of your custom checks you can send fe an email or not. The only problem could be that the form will not be displayed after isValid() is true. The code is not designed to handle such special cases, sorry!