Jump to content


Multiselect validation fails on v1.5.7


  • Please log in to reply
4 replies to this topic

#1 Kostas Botonis

Kostas Botonis

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 10 October 2016 - 08:48 PM

Hi there,

I have noticed that if there is a multiselect field required the validation fails. This happens on all cases (n-n relation, enum database field, field_type multiselect). Could you please guide me on a solution on this?

 

Capture.PNG



#2 Vitor Cricas

Vitor Cricas

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 17 March 2017 - 01:02 PM

Yes it's true!

 

Workaround:

 

$crud->required_fields('multiselect_field');    

 

$crud->set_rules('multiselect_field', 'Title', 'required|callback_check_multiselect_field');

 

...

 

    function check_multiselect_field($value){

//value outputs nothing
        $values = $this->input->post('multiselect_field');
        if (!is_array($values)){
            $this->form_validation->set_message('check_multiselect_field', 'Field mandatory');            
            return false;
        }
        return true;
    }   



#3 Json Sean

Json Sean

    Newbie

  • Members
  • Pip
  • 9 posts

Posted 14 September 2017 - 08:46 AM

Modify file of 'system/libraries/Form_validation.php':

 

in the function "public function run($group = '')",before _execute action add codes like this:

 

...

 

if(in_array('required',$row['rules']) and is_array($row['postdata'])){
$row['postdata'] = json_encode($row['postdata'],JSON_UNESCAPED_UNICODE);
}

 

...
$this->_execute($row, $row['rules'], $row['postdata']);



#4 prattom

prattom

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 06 July 2018 - 01:02 PM

This is still a bug in latest version of grocery crud 1.6.1. There was no such problem in older version 1.5.1



#5 michaelh613

michaelh613

    Member

  • Members
  • PipPip
  • 16 posts

Posted 07 August 2018 - 01:23 PM

I can confirm the error is still occurring is there any plans to fix the problem soon?  It's not mentioned in the known issues portion of the site.  






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users