⚠ In case you've missed it, we have migrated 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 is an archived forum. ⚠

  •     

profile picture

radio button value not saving in table



dhoni223
  • profile picture
  • Member

Posted 28 February 2018 - 07:45 AM

 public function payment()
    {
    
$crud = new RMCL_grocery_CRUD();
$crud->set_theme('bootstrap-v4');
        $crud->set_table('payment');
   $crud->set_subject("_payment");
        $crud->set_js('resources/js/rmcl_label.js');
        $crud->callback_add_field('payment_type',array($this,'add_field_callback_1'));
        $crud->callback_edit_field('payment_type',array($this,'add_field_callback_1'));
        $crud->set_js('resources/js/sample.js');
        $output = $crud->render();
$this->addData('output', $output);
        $this->render('app/crud_view');   
    }
    function add_field_callback_1()
    {
        return ' 
            <input type="radio" name="tags" value="money" id="yescheck" /> MoneyOrder<br/>
  <input type="radio" name="tags" value="cash" id="nocheck"/> Cash<br/>
  <input type="radio" name="tags" value="cheque" id="nocheck"/> Cheque<br/>
  <script>
        </script>';
    }
    
}

 


Amit Shah
  • profile picture
  • Member

Posted 28 February 2018 - 09:23 AM

u need to refer the field names that are generated through the GC library - the field names are field_<fieldName>

 

so the here .. the code could change to...

 <input type="radio" name="field_payment_type" value="cheque" id="nocheck"/> Cheque<br/>

 

that way - the library will be able to pickup the value for the field...

 

that should work for you

 

Happy GCing :)


dhoni223
  • profile picture
  • Member

Posted 01 March 2018 - 05:01 AM

 public function payment()
    {
    
$crud = new RMCL_grocery_CRUD();
$crud->set_theme('bootstrap-v4');
        $crud->set_table('payment');
$crud->set_subject("_payment");
        $crud->set_js('resources/js/rmcl_label.js');
        $crud->callback_add_field('payment_type',array($this,'add_field_callback_1'));
        $crud->callback_edit_field('payment_type',array($this,'add_field_callback_1'));
        $crud->set_js('resources/js/sample.js');
        $crud->display_as('suscriber_id','subscriber_id');
        $crud->set_relation('subscriber_id','wp_rmcl_pub_subscription','subscriber_id'); 
        $con=mysqli_connect('localhost','root','123456','armdb');
        $output = $crud->render();
$this->addData('output', $output);
        $this->render('app/crud_view');   
    }
    function add_field_callback_1()
    {
        return ' 
            <input type="radio" name="field_payment_type" value="money" id="yescheck" /> MoneyOrder<br/>
  <input type="radio" name="field_payment_type" value="cash" id="nocheck"/> Cash<br/>
  <input type="radio" name="field_payment_type" value="cheque" id="nocheck"/> Cheque<br/>';
    }
    
}

still not working


Amit Shah
  • profile picture
  • Member

Posted 05 March 2018 - 04:08 AM

Do one thing - add a callback before insert - there check in all the fields that are getting submitted - 

 

Also - do tell 1 thing - dose this field (payment_type) exists in the table or not? and by that same name..!!

The only possibility for you now is debugging.. as why it aint going in - technically it should not have such issues!!