【问题标题】:How to auto fill textbox with data have selected when click edit button单击编辑按钮时如何使用已选择的数据自动填充文本框
【发布时间】:2020-01-06 02:26:09
【问题描述】:

当我点击编辑按钮时,如何在文本框中自动显示数据,我想使用这样选择的 jquery 显示数据库中的数据: enter image description here ,抱歉,如果我的问题不清楚,如果有人无法问我,请帮助

这是我的代码

<?php
$main_controll = new App_UserManagement_Control_UserManagement();
$data_from_ctr = $main_controll->edit();
echo json_encode( $data_from_ctr);
?>

<tr class="odd">
            <td width="150"><strong>Account Access</strong></td>
            <td width="10">:</td>
            <td colspan="2">
            <select id="acctAccessed" name="acctAccessed[]" multiple="multiple" class="chosen-select" style="width:350px;" data-placeholder="Select account">
            <?php foreach ($data_from_ctr['rek'] as $data) :?>
            <option <?php if ($data['selected'] == "1"){ ?> selected= "" <? } ?> value="<?php echo $data['idRek'];?>"><?php echo $data['idRek'];?></option>
            <?php endforeach; ?>
            </select>
            <input id="chkall" type="checkbox" >Select All</input>
        </td>

<script type="text/javascript">
      $("#acctAccessed").chosen();
</script>

但是我的错误是这样的,我没有获得帐户访问的数据 enter image description here

【问题讨论】:

  • 你试过用placeholder=代替data-placeholder=吗?
  • 不,我没有尝试,我现在要尝试@Arkin Solomon
  • 我已经尝试过同样的结果@ArkinSolomon

标签: javascript php jquery


【解决方案1】:

您可以将 $data_from_ctr 发布为,您上面提到的代码正在运行。

【讨论】:

  • 是的,数据显示为列表下拉列表,但没有显示为选中@shreyanshu agarwal
猜你喜欢
  • 1970-01-01
  • 2015-05-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-19
  • 2011-12-17
  • 2010-10-09
  • 1970-01-01
相关资源
最近更新 更多