gpt4 book ai didi

javascript - Rails form_tag 以另一种形式远程

转载 作者:行者123 更新时间:2023-12-02 13:51:03 24 4
gpt4 key购买 nike

我一直在关注这个视频http://railscasts.com/episodes/240-search-sort-paginate-with-ajax?autoplay=true我试图以另一种形式搜索记录但不起作用,我该如何解决这个问题?我需要将搜索表单放入创建表单来搜索要保存的记录。这是我的表格:

<%= form_for(@cliente, remote: true, html: {class: "form-horizontal cliente-validado"}) do |f| %> <!--ajax remote: true-->
<div class="modal fade" id="mynewcliente" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">Agregar cliente</h4>
</div>
<div class="modal-body">

<%= f.label :IdCli, "Clave:", class: "control-label col-md-2" %>
<div class="col-md-7">
<%= f.text_field :IdCli, class: "form-control cliente-idcli",autofocus: true, minlength: "1", required: "true" %>
</div>

<!--the search form-->
<%= form_for("/busqueda_cp", method: 'get', remote: true, id:"cp_search" ) do |l| %>
<p>
<%= l.text_field :search, params[:search]%>
<%= submit_tag "Search", :name => nil%>
</p>
<%end%>
<div id="cp"><%= render 'cp' %></div>

<div class="form-group">
<%= f.label :Status,"Activo:", class: "control-label col-xs-3 col-sm-6 col-md-1 " %>
<div class="col-md-1">
<%= f.check_box :Status, checked: true %>
</div>
</div>
</div>

<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" id="mynewclienteclose">Close</button>
<%= submit_tag "Create", class: "btn btn-primary", data: { disable_with: 'Creando' }%>
</div>
</div>
</div>
</div>
<%end%>
</div>

最佳答案

浏览器不支持嵌套表单(表单内的表单)(不是 w3c 标准的一部分),并且它可能会导致不可预测的行为。

您可以在这里阅读更多相关信息:

关于javascript - Rails form_tag 以另一种形式远程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41024333/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com