Sandeep Gudibanda | 19 Jul 21:44

text_field_with_auto_complete - Trigger on NonSelecting


Hi,

I am using  text_field_with_auto_complete on a field. I update a part of
my page if user chooses any particular option listed by auto_complete
list. To do this I call and remote_function  with :after_update_element.

But I also wanna update a part of my page if user doesn't select
anything from the autocomplete list.

For EX: I want to Bring it to notice of the user that the "Name" that he
has not entered is not in our database. The div like below should be
higlighted

<div id ="error_box" class="error_box" style="display:none">
<span class="showtext bold"> Hospital entered was not found. Please
enter the details here: </span>
</div>

So what I need to do is : When control moves out of the field on which
auto_complete is enacted, and when user doesn't select any option listed
by auto_complete, I want to trigger a different action.

I tried to simulate this using text_field_with_auto_complete along with
observe_field :on => :change. It didn't help, as onChange gets triggered
on both cases: User selecting one option from the list and User entering
a new Name.

How can I solve this? Please suggest.

(Continue reading)

Xavier Noria | 20 Jul 23:39

Re: text_field_with_auto_complete - Trigger on NonSelecting


On Sat, Jul 19, 2008 at 9:46 PM, Sandeep Gudibanda
<rails-mailing-list@...> wrote:

> I am using  text_field_with_auto_complete on a field. I update a part of
> my page if user chooses any particular option listed by auto_complete
> list. To do this I call and remote_function  with :after_update_element.
>
> But I also wanna update a part of my page if user doesn't select
> anything from the autocomplete list.
>
> For EX: I want to Bring it to notice of the user that the "Name" that he
> has not entered is not in our database. The div like below should be
> higlighted
>
> <div id ="error_box" class="error_box" style="display:none">
> <span class="showtext bold"> Hospital entered was not found. Please
> enter the details here: </span>
> </div>
>
> So what I need to do is : When control moves out of the field on which
> auto_complete is enacted, and when user doesn't select any option listed
> by auto_complete, I want to trigger a different action.
>
> I tried to simulate this using text_field_with_auto_complete along with
> observe_field :on => :change. It didn't help, as onChange gets triggered
> on both cases: User selecting one option from the list and User entering
> a new Name.

model_auto_completer
(Continue reading)

Xavier Noria | 21 Jul 00:20

Re: text_field_with_auto_complete - Trigger on NonSelecting


On Sun, Jul 20, 2008 at 11:39 PM, Xavier Noria <fxn@...> wrote:

> To accomplish this the textfield has a custom cache attribute. When
> the user selects some completion the cache is reset in
> :after_update_element. There's an onblur handler

It is an onchange handler currently.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Gmane