I've been following this video http://railscasts.com/episodes/240-search-sort-paginate-with-ajax?autoplay=true and I am trying to search records in another form but don't work, How can I solve this? I need to put the search form in to create form to search records to save. this is my form:
<%= 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">×</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>
Nested forms (a form inside a form) are unsupported by browsers (not part of the w3c standard) and it could cause unpredictable behavior.
You can read more about this here:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.