Reputation: 17
I have explored the new Grocery CRUD library & working on it easily. I am now stuck on a problem. I have a 2 tables with their fields-
name_table : id , Name , Item1, Price1
items_table : id, Item2, Price2
Now I can choose the field -(Item2) of items_table to be listed as a dropdown to name_table while adding the record using set_relation function. But how do i insert the value of Price2 --> Price1 after the front end user has selected a specific dropdown.
Please check below Image Link & help me
Upvotes: 0
Views: 631
Reputation: 114
you can use:
$crud->callback_field('field', array($this, 'field_callback'));
and in field_callback function:
function field_callback($value = '', $primary_key = null)
{
$returner = "<select name='field' ></select>
<script type='text/javascript'>
-- JS AJAX SCRIPT
</script>";
return $returner;
}
in this way you make a custom field with custom ajax in front end for your custom action
Upvotes: 1