我正在使用 address_picker-rails gem,它非常适合第一个输入,但由于某种原因不是第二个。我现在经历了一百万次。有什么想法吗?
下面带有 Jquery 的 _new 表单代码:
<%= form_for(@post) do |f| %>
<% if @post.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being
saved:</h2>
<ul>
<% @post.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<fieldset>
<div class="field">
<%= f.label :from %><br />
<%= f.text_field :from, :class => 'address-picker-input' %>
</div>
</fieldset>
<fieldset>
<div class="field">
<%= f.label :to %><br />
<%= f.text_field :to, :class => 'address-picker-input' %>
</div>
</fieldset>
<script type="text/javascript">
//AddressPickerRails.Pickers.applyOnReady({
// 'onLoad':function (railsPicker) {
// console.debug("callback for a single post with ID '%s'",
railsPicker.getIdPrefix());
// }
//});
AddressPickerRails.Pickers.apply({
'onLoad':function (railsPicker) {
console.debug("callback for a single post with ID '%s'",
railsPicker.getIdPrefix());
}
});
</script>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
HTML 代码:
<div class="field">
<label for="post_to">To</label><br>
<input class="address-picker-input ui-autocomplete-input" id="post_to" name="post[to]"
size="30" type="text" autocomplete="off"><span role="status" aria-live="polite"
class="ui-helper-hidden-accessible">19 results are available, use up and down arrow
keys to navigate.</span>
</div>
<div class="field">
<label for="post_from">From</label><br>
<input class="address-picker-input" id="from_field" name="post[from]" size="30"
type="text">
</div>
有什么想法吗?