[英]Grocery CRUD : Auto-Insert corresponding value of a field after Dropdown has been selected
I have explored the new Grocery CRUD library & working on it easily. 我探索了新的Grocery CRUD库并轻松进行工作。 I am now stuck on a problem.
我现在陷入一个问题。 I have a 2 tables with their fields-
我有2张桌子,上面有他们的字段-
name_table : id , Name , Item1, Price1 name_table :id,Name,Item1,Price1
items_table : id, Item2, Price2 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. 现在,我可以选择的领域- (项目2)items_table的被列为一个下拉同时使用set_relation功能添加记录name_table。 But how do i insert the value of Price2 --> Price1 after the front end user has selected a specific dropdown.
但是,在前端用户选择了特定的下拉菜单之后,如何插入Price2-> Price1的值。
Please check below Image Link & help me 请检查下面的图片链接并帮助我
you can use: 您可以使用:
$crud->callback_field('field', array($this, 'field_callback'));
and in field_callback function: 并在field_callback函数中:
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 这样,您可以在前端使用自定义ajax创建自定义字段,以执行自定义操作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.