Jump to content


setRule not working properly

setRule regex grocerycrudenterprise

  • Please log in to reply
No replies to this topic

#1 gcshyam

gcshyam

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 29 May 2020 - 03:42 PM

I have a grocerycrud Enterprise licence, I am trying to use following codes, it is not working .

 

1. $crud->setRule('Email','regex','//^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/');

2. $crud->setRules(
                [
                    'fieldName'  => 'Email',
                    'rule'       => 'regex',
                    'parameters' => '//^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/'
                ]
        );

for the second code I got the following error:

h4>A PHP Error was encountered</h4>

<p>Severity: Warning</p>
<p>Message:  Illegal string offset 'fieldName'</p>
<p>Filename: State/StateAbstract.php</p>
<p>Line Number: 1488</p>
    <p>Backtrace:</p>
            <p style="margin-left:10px">
            File: C:\xampp\htdocs\ci-grcrud-vanilla\application\libraries\GroceryCrudEnterprise\grocerycrud\enterprise\src\GroceryCrud\Core\State\StateAbstract.php<br />
            Line: 1488<br />
            Function: _error_handler            </p>
            <p style="margin-left:10px">
            File: C:\xampp\htdocs\ci-grcrud-vanilla\application\libraries\GroceryCrudEnterprise\grocerycrud\enterprise\src\GroceryCrud\Core\State\UpdateState.php<br />
            Line: 50<br />
            Function: getValidationRules            </p>
            <p style="margin-left:10px">
            File: C:\xampp\htdocs\ci-grcrud-vanilla\application\libraries\GroceryCrudEnterprise\grocerycrud\enterprise\src\GroceryCrud\Core\GroceryCrud.php<br />
            Line: 2450<br />
            Function: render            </p>
            <p style="margin-left:10px">
            File: C:\xampp\htdocs\ci-grcrud-vanilla\application\controllers\Examples.php<br />
            Line: 100<br />

 

 







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users