Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Autocomplete and save onblur
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Shandy Nantz  
View profile  
 More options Jul 20 2012, 4:58 pm
From: Shandy Nantz <li...@ruby-forum.com>
Date: Fri, 20 Jul 2012 22:58:42 +0200
Local: Fri, Jul 20 2012 4:58 pm
Subject: Autocomplete and save onblur
Hi all,

I have am autocomplete field that (is supposed) to save the selection as
soon as it selected from the drop down. The issue is that the method to
save is called before the selection is made because when I click the
selection is when the onblur happens. Here is my code:

<span id = "contract_to_region_div_<%= @contract.id.to_s %>" style =
"padding-right: 16px; <% if @contract.all_airports == true %>display:
none;<% end %>">
  <% @toregion = Region.find_by_id(@contract.to_region) %>
  <% func_contract_to_region = remote_function( :complete =>
     'Element.hide(\'\');', :loading =>
     'Element.show(\'loading_contract_to_region_div_'
      + @contract.id.to_s +
     '\');', :url => {
        :action => 'save_contract_attribute_auto_complete',
        :model => 'contract', :attr => 'to_region',
        :contract_id => @contract.id, :look_up_model => 'Region',
        :look_up_attr =>  'region_name',
        :field_id => 'to_region_' + @contract.id.to_s},
     :submit => 'contract_to_region_div_' + @contract.id.to_s) -%>

   To  Region<br />
   <%= text_field_with_auto_complete_with_id_checking
        :region, :region_name, {:id => 'to_region_' + @contract.id.to_s,
        :value => !...@toregion.blank? ? @toregion.region_name : '',
        :size => 20, :onblur => func_contract_to_region},
        {:url => {
          :action => "auto_complete_for_region_region_name",
          :pseudo_id => @pseudo.id }
        } %>
</span>

I can't think of another way to make this happen, such as through a
onclick, onkeydown, etc. I think if I used onfocus this method would get
called twice, when I first click in the field to enter the data, and a
second time when I make the selection, and I think it would make this
work
awkwardly.

Just wondering if anybody has tried this and got it to work the way they
wanted? Thanks,

-S

--
Posted via http://www.ruby-forum.com/.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »