Jump to content

Andy

Members
  • Posts

    157
  • Joined

  • Last visited

  • Days Won

    2

Andy last won the day on April 30 2024

Andy had the most liked content!

Profile Information

  • Gender
    Male
  • Location
    Cyprus

Recent Profile Visitors

6,385 profile views

Andy's Achievements

Sr. Member

Sr. Member (5/6)

133

Reputation

  1. Hi @Juergen Got the ability to make flexible rules and a multi-step input form. The ability to make your own validation rules is a very powerful thing. Thanks.
  2. Hi @Juergen Thanks for the information. I will read the Valitron documentation more carefully. However, I need this rule quite often. I think that adding the 'cyrillicName' rule is more correct for the code. Thanx
  3. Hi @Juergen Good news everybody. Custom validation rules work. I'll add one more proven validation rule to the general collection. Check to enter a Cyrillic first, last or middle name. In ready.php // // Cyrillic name may contain lowercase and uppercase а-я and hyphen // \Valitron\Validator::addRule('cyrillicName', function ($field, $value) { $regex = '/[^а-яё\-]/iu'; if (!preg_match($regex, $value)) { return true; } return false; },'contains not allowed characters. Cyrillic name may contain lowercase and uppercase а-я and hyphen (no whitespaces).');
  4. The posts are frozen in the red zone again. Maybe some kind of restriction has been violated?
  5. Hi @Juergen I continue to admire you. Yes, that's exactly what I meant. That's what I was thinking about writing a new validation rule, just haven't decided how to do it yet. I was going to use hooks. You've shown a logical solution. Thank you. I think FrontendForms users can share their useful validation rules in this thread.
  6. Hi @Juergen Thank you for your quick response. You are always helpful. This code now works and shows an error message at the beginning of the form. However, the problem is that despite the error, the variable $form->isValid() = true. And the form submittal happens. Is there any way to tell the form that it is invalid? And make $form->isValid() = false. That would solve all the problems with additional inspections.
  7. Hi @Juergen Method: $alert0 = $form->getAlert(); $alert0->setErrorMsg($e_msg); Causes an error: Exception: Method Alert::setErrorMsg does not exist or is not callable in this context Is there any other method to set $form->isValid() to false?
  8. Hi Juergen First of all, I didn't find the setErrorMessage function in your code. But you have the setErrorMsg function. Here's the code I used: if($form->isValid()) { $selector = $sanitizer->text($form->getValue('title'), $options = ['stripQuotes'=>true,'stripSpace'=>true]); $selector = preg_replace('/[^а-яё]/ui','', $selector); If(empty($selector)){ // set an error message at the top of the form $e_msg = "The name must be in Cyrillic."; $alert0 = $form->getAlert(); $alert0->setErrorMsg($e_msg); } } However, I get an error either way: Exception: Method Alert::setErrorMsg does not exist or is not callable in this context (in wire/core/Wire.php line 563) Perhaps there is some other way to change the value of $form->isValid() to false?
  9. Hi @Juergen First of all, I didn't find the setErrorMessage function in your code. But you have the setErrorMsg function. Here's the code I used: if($form->isValid()) { $selector = $sanitizer->text($form->getValue('title'), $options = ['stripQuotes'=>true,'stripSpace'=>true]); $selector = preg_replace('/[^а-яё]/ui','', $selector); If(empty($selector)){ // set an error message at the top of the form $e_msg = "The name must be in Cyrillic."; $alert0 = $form->getAlert(); $alert0->setErrorMsg($e_msg); } } However, I get an error either way: Exception: Method Alert::setErrorMsg does not exist or is not callable in this context (in wire/core/Wire.php line 563) Perhaps there is some other way to change the value of $form->isValid() to false?
  10. Impressive website. There's a lot to learn from you.
  11. Hi @Juergen Unfortunately, the suggested example doesn't work 18 hours ago, Juergen said: if ($form->isValid()) { //make your custom check here (fe checking a form value against the database) if(customcheck is valid){ // go on with your code } else { // set an error message at the top of the form $alert = $form->getAlert(); $alert->setErrorMessage('Sorry, but there are errors inside the form'); // set an error message on the inputfield itself (fe. an email input) $emailInput = $form->getFormElementByName('email); $emailInput->setErrorMessage('There is an error'); } } First of all, I didn't find the setErrorMessage function in your code. But you have the setErrorMsg function. Here's the code I used: if($form->isValid()) { $selector = $sanitizer->text($form->getValue('title'), $options = ['stripQuotes'=>true,'stripSpace'=>true]); $selector = preg_replace('/[^а-яё]/ui','', $selector); If(empty($selector)){ // set an error message at the top of the form $e_msg = "The name must be in Cyrillic."; $alert0 = $form->getAlert(); $alert0->setErrorMsg($e_msg); } } However, I get an error either way: Exception: Method Alert::setErrorMsg does not exist or is not callable in this context (in wire/core/Wire.php line 563) Perhaps there is some other way to change the value of $form->isValid() to false?
  12. I have a question about additional checks. How can I organize custom checks on the database? For example, how can I prohibit duplication of e-mail value or participant's number or full namesake?
  13. I think it is possible even now. You can add a “I agree with the personal data policy” field to the customer profile. And make a link to the policies outside the form.
  14. Hi @bernhard This project looks extremely interesting. I use Tabulator for frontend and find it one of the best solutions for tables. It's great that you have made it easier to use it in the backend. Thank you for another one great module. By the way, I have up to 50 columns in a table, and the database has over 1,000,000 items. However, it doesn't make much sense to make tables of even 10,000 rows. It is better to categorize them and show them in separate tables.
×
×
  • Create New...