⚠ In case you've missed it we are migrating to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This forum is read-only and soon will be archived. ⚠


fede72bari

Member Since 24 Mar 2020
Offline Last Active Mar 22 2021 09:27 AM
-----

Topics I've Started

MULTISELECT AND REQUIRED FIELD GIVES ALWAY ERROR ON SAVING

17 March 2021 - 05:57 PM

When setting a multiselect field as required, on saving it give always the following error: "The Usages field is required." as if the field was empty that actually is not. I saw many other posts for the same bug, any intention to fix it?

 

 


Cstome Error Message On set_rule callback does NOT appear

06 March 2021 - 11:46 AM

Hi all,

 

setting a rule for checking that a record is not already present in the DB and preventing double insertion

 

        if( $this->grocery_crud->getState() == 'insert'){
log_message('error', "INSERT STATE FOR NEW VENDOR OFFER");
            // check that the offer is not existing, but just when trying to insert a new offer
            // obviusly when updateing the offer that offeris already existing and the following control
            // shall be avoided
            $this->grocery_crud->set_rules('vendors_id','Vendors ID','callback__check_not_existing'); 
        }
        else{
log_message('error', "NOT INSERT STATE: ".$this->grocery_crud->getState());   
        }

and the callback 

 

    function _check_not_existing(){
    
        $form_variables = $this->input->post();
        
        $query = "SELECT id 
                  FROM vendors_offers
                  WHERE vendors_id = ". $form_variables['vendors_id'] ." AND products_id = ". $form_variables['products_id'];
        $query_res =  $this->db->query($query);
        $query_rows = $query_res->result_array();
log_message('error', "vendors_id: ".$form_variables['vendors_id']." - products_is: ".$form_variables['products_id']);
        if(count($query_rows) > 0){
log_message('error', "offers already inserted");           
            //print_r(json_encode(['success'=>false, 'error_message'=>'This product has been already linked to the selected vendor with an existing vendor offer.']));
            $this->form_validation->set_message('_check_not_existing', 'This product has been already linked to the selected vendor with an existing vendor offer.');
            
            return false;
        }
        else{
            
            return true;
        }
                                                
    }

everything work properly, but the error message. I get an alert box with this text "An error has occurred on insert." insted the desired "This product has been already linked to the selected vendor with an existing vendor offer.". What have I misunderstood? Thank you all.

 

PS: in the browser consol I have these warnings, but maybe they are not  linked to the problem:

 

Uncaught TypeError: $(...).tooltip is not a function
    at pageSetUp (app.min.js:1)
    at HTMLDocument.<anonymous> (form_validate.js:3)
    at j (jquery-1.11.1.min.js:2)
    at Object.fireWith [as resolveWith] (jquery-1.11.1.min.js:2)
    at Function.ready (jquery-1.11.1.min.js:2)
    at HTMLDocument.J (jquery-1.11.1.min.js:2)
Grammarly-check.js:2 Uncaught TypeError: Cannot read property 'dataset' of null
    at Object.t.init (Grammarly-check.js:2)
    at Function.t.start (Grammarly-check.js:2)
    at Grammarly-check.js:2
    at Grammarly-check.js:2
    at Grammarly-check.js:2

 

 

 


callback_action and custom filtering not yet available? CALL evaluate the need

08 January 2021 - 10:43 AM

Hi all,

 

I see as common needs since 2012 in the forum

 

1. an easy way to customize the Actions column for each row differently: I saw a very old answer in 2012 proposing a callback_action API function. 

2. an easy way to add filters (radio buttons, drop down list, etc) at the top of the list table for defining custom filters

 

After 9 years, is there anything developed for these needs?

 

Secondarly why is the true_false field names customization implemented for the list table and the edit mode, but NOT in the viiew mode? 

 

Thanks.


Boolean field value not shown in view mode

06 January 2021 - 12:42 PM

Hi all,

 

I have a boolean field "root_version", a tinyint in the DB, the value of which is shown correclty in the list table, as well as it is shown correctly in the edit mode, but surprising it is not shown in the view mode. In the view mode it is correctly shown the label "Root Version:", but after the ":" the value space is empty.

 

The view mode shows the default fields (all but the primary key), while the other modes have customized field list as following defined

        $this->grocery_crud->set_table('survey_models');
        
        
        // TABLE, NEW, EDIT FIELDS                                                                                                                
        $this->grocery_crud->columns('id','name','type', 'root_version','state','version_number','root_version_id','min_enabling_answers','survey_modification_grant_category', 'max_survey_score', 'max_exclusion_count', 'global_survey_duration_days', 'user_answer_duration_days', 'not_completed_sections_progress', 'creation', 'languages_id');
        $this->grocery_crud->add_fields('name','type','state', 'min_enabling_answers', 'ref_db', 'ref_table_name', 'ref_table_primary_key_column_name', 'ref_table_reference_name_column', 'survey_modification_grant_category', 'user_db', 'user_table_name', 'user_table_primary_key_column_name', 'user_table_user_category_column_name', 'user_session_var_name',
                                        'user_categories_list_db', 'user_categories_list_db', 'user_categories_list_table_name', 'user_categories_list_table_primary_key_name', 'list_of_allowed_user_category_ids', 'max_survey_score', 'max_exclusion_count', 'global_survey_duration_days', 'user_answer_duration_days', 'not_completed_sections_progress', 'languages_id');
        $this->grocery_crud->edit_fields('name','type','state', 'root_version', 'min_enabling_answers', 'ref_db', 'ref_table_name', 'ref_table_primary_key_column_name', 'ref_table_reference_name_column', 'survey_modification_grant_category', 'user_db', 'user_table_name', 'user_table_primary_key_column_name', 'user_table_user_category_column_name', 'user_session_var_name',
                                        'user_categories_list_db', 'user_categories_list_db', 'user_categories_list_table_name', 'user_categories_list_table_primary_key_name', 'list_of_allowed_user_category_ids', 'max_survey_score', 'max_exclusion_count', 'global_survey_duration_days', 'user_answer_duration_days', 'not_completed_sections_progress', 'languages_id');
        
        // BOOLEANS LABELS
        $this->grocery_crud->field_type('root_version','true_false', array('1' => 'yes', '0' => 'no'));

The last field_type function does not change the situation, even if skipped the result dow not change. Any ideas? thanks. Federico.

 

 


Bollean field value not shown in view mode

05 January 2021 - 06:36 PM

Hi all,

 

I have a boolean fiel "root_version", a tinyint in the DB, the value of which is shown correclty in the list table, as well as it is shown correctly in the edit mode, but surprising it is not shown in the view mode. In the view mode it is correctly shown the label "Root Version:", but after the ":" the value space is empty.

 

The view mode shows the default fields (all but the primary key), while the other modes have customized field list as following defined

 

 

        $this->grocery_crud->set_table('survey_models');
        
        
        // TABLE, NEW, EDIT FIELDS                                                                                                                
        $this->grocery_crud->columns('id','name','type', 'root_version','state','version_number','root_version_id','min_enabling_answers','survey_modification_grant_category', 'max_survey_score', 'max_exclusion_count', 'global_survey_duration_days', 'user_answer_duration_days', 'not_completed_sections_progress', 'creation', 'languages_id');
        $this->grocery_crud->add_fields('name','type','state', 'min_enabling_answers', 'ref_db', 'ref_table_name', 'ref_table_primary_key_column_name', 'ref_table_reference_name_column', 'survey_modification_grant_category', 'user_db', 'user_table_name', 'user_table_primary_key_column_name', 'user_table_user_category_column_name', 'user_session_var_name',
                                        'user_categories_list_db', 'user_categories_list_db', 'user_categories_list_table_name', 'user_categories_list_table_primary_key_name', 'list_of_allowed_user_category_ids', 'max_survey_score', 'max_exclusion_count', 'global_survey_duration_days', 'user_answer_duration_days', 'not_completed_sections_progress', 'languages_id');
        $this->grocery_crud->edit_fields('name','type','state', 'root_version', 'min_enabling_answers', 'ref_db', 'ref_table_name', 'ref_table_primary_key_column_name', 'ref_table_reference_name_column', 'survey_modification_grant_category', 'user_db', 'user_table_name', 'user_table_primary_key_column_name', 'user_table_user_category_column_name', 'user_session_var_name',
                                        'user_categories_list_db', 'user_categories_list_db', 'user_categories_list_table_name', 'user_categories_list_table_primary_key_name', 'list_of_allowed_user_category_ids', 'max_survey_score', 'max_exclusion_count', 'global_survey_duration_days', 'user_answer_duration_days', 'not_completed_sections_progress', 'languages_id');
        
        // BOOLEANS LABELS
        $this->grocery_crud->field_type('root_version','true_false', array('1' => 'yes', '0' => 'no'));

The last field_type function does not change the situation, even if skipped the result dow not change. Any ideas? thanks. Federico.