代码之家  ›  专栏  ›  技术社区  ›  user8486381

如何在数据库中提交表单后重置文本字段(使用目标iframe)

php
  •  0
  • user8486381  · 技术社区  · 9 年前

    我对target iframe有问题。我想在表单提交/数据插入数据库后重置字段

    提前感谢!

                        <form method="POST" name="chatform" autocomplete="off" target="iframe">
                        <div class="panel-footer">
                            <input type="hidden" name="user" value="<?php echo $username; ?>">
                            <div class="input-group">
                                <input id="btn-input" type="text" name="chat" class="form-control input-sm" placeholder="Type your message here..." />
                                <span class="input-group-btn">
                                    <button class="submit btn btn-info btn-sm" name="send">
                                        <i class="fa fa-send-o"></i>
                                    </button>
                                </span>
                            </div>
                        </div>
                        </form>
    
                        <iframe width="0" height="0" frameborder="0" name="iframe"></iframe>
    
    3 回复  |  直到 9 年前
        1
  •  1
  •   user8486381 user8486381    9 年前
    <form method="POST" id="frame" name="chatform" autocomplete="off" target="iframe">
    
    </form>                                           
    
    <iframe width="0" height="0" frameborder="0" name="iframe" onload="parent.document.getElementById('frame').reset();"></iframe>
    

        2
  •  0
  •   rndus2r    9 年前

    看看 onsubmit 以获得清洁的解决方案。

    <form method="POST" name="chatform" autocomplete="off" target="iframe" onsubmit="this.reset();">

        3
  •  -1
  •   Niklesh Raut    9 年前

    您可以使用javascript

     <form method="POST" onsubmit="return formSubmit()" id="frame" ....
    
    
     <script>
       $("#frame").reset();
       return true;
    </script>
    

    推荐文章