My solution to making sure a valid value has been entered into an
autocomplete is to include a hidden field on the page that stores the
id of the object selected.

To start, the hidden field is empty, but when I start typing and then
select a valid option, I set the value of the hidden field to the id
associated with the selected option from the autocomplete.  If the
text in the autocomplete changes, I set the hidden field to blank and
set it back to a valid id when another valid option is selected from
the autocomplete.  Then on form submission if the hidden field is
blank then I show a message saying that no valid entry has been
selected, otherwise the hidden field has an id and is submitted along
with the form.

Anyway, this is what I've done and it works just fine.

On 11/11/06, Deco Rior <[EMAIL PROTECTED]> wrote:
>
> Actually, I do catch it easily on the submission, but that is
> soooooooo Web 1.0 :-)
>
> Deco
> On Nov 11, 2006, at 4:28 PM, Steven Q. Evans wrote:
>
> >
> > Hi Deco...
> >
> > I am having the same problem right now, as well with the
> > autocompleter you helped me set up eons ago.  I'll be interested to
> > hear about a solution on this!
> >
> > sqe
> >
> > On Nov 11, 2006, at 12:25 PM, Deco Rior wrote:
> >
> >>
> >> Thought it was easy but not so.
> >>
> >> Here is the problem...
> >>
> >> The user enters in a partial name , e.g. Rio
> >>
> >> It brings up a list but the user does not select from the list
> >>
> >> When I submit it to a form I have a value that has multiple matches.
> >>
> >> I need to check the user has selected a value.
> >>
> >> I cannot use afterUpdateElement since it only works after the
> >> selection.
> >>
> >> Any ideas?
> >>
> >> Deco
> >> On Nov 2, 2006, at 8:53 AM, Deco Rior wrote:
> >>
> >>>
> >>> :-)
> >>>
> >>> Well there you have it!
> >>>
> >>> It is pretty easy for me to solve.
> >>>
> >>> I will just validate either on change of before form submission.
> >>>
> >>> Deco
> >>>
> >>> On Nov 2, 2006, at 7:54 AM, Martin Bialasinski wrote:
> >>>
> >>>>
> >>>> On 11/2/06, Deco Rior <[EMAIL PROTECTED]> wrote:
> >>>>
> >>>>> was kind of suprised I could not find an elegant extension of
> >>>>> this in
> >>>>> autocompleter
> >>>>
> >>>> The best explanation: No one needed this so far.
> >>>>
> >>>> Bye,
> >>>>   Martin
> >>>>
> >>>>>
> >>>
> >>>
> >>>>
> >>
> >>
> >>>
> >>
> >
> > Steven Q. Evans
> > Director of Technological Resources
> > MSI Productions
> > (858)344-3351 • (858)348-0629 • (707)215-1032 Fax •
> > [EMAIL PROTECTED]
> >
> >
> > >
>
>
> >
>

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

Reply via email to