【问题标题】:Unable to reset form in codeigniter无法在 codeigniter 中重置表单
【发布时间】:2015-08-02 15:47:08
【问题描述】:

我正在使用三种不同的方法来重置我的表单,但单击按钮后仍然没有任何反应,这是我的表单结构: 任何帮助将不胜感激

$this->load->helper('form');
$attributes = array('class' => 'form-inline', 'id' => 'ProductForm');
echo form_open_multipart("product/process/$id",$attributes);
.
.
.
<?php echo  form_reset(array('id'=>'reset','value'=>'resetme'));?>        
<button onclick="ResetForm();">Reset Form</button>
<button type="reset" value="Reset">Reset</button>
<?php echo form_close();?>
<script>
function ResetForm() {
    document.getElementById("ProductForm").reset() ;
}
</script>
//same for form_open()

【问题讨论】:

    标签: php forms codeigniter reset


    【解决方案1】:

    你也试过

    <input type="reset" value="Reset">
    

    【讨论】:

      【解决方案2】:

      @Mahdi Younesi:只需使用输入类型重置,然后测试它是否会重置表单元素。

      【讨论】:

        【解决方案3】:

        先在form中添加一些输入类型来测试reset功能

        解决办法

        在表单中添加一个输入,然后

        替换 form_reset(array('id'=>'reset')); to form_reset(array('id'=>'reset','value'=>"resetme"));

        【讨论】:

        • 谢谢,但我之前给过价值,但之前没有提及
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2018-04-27
        • 1970-01-01
        • 2011-10-10
        • 2021-08-04
        • 1970-01-01
        • 2015-09-02
        • 2017-02-07
        相关资源
        最近更新 更多