rubyonrailsin

A Ruby and Rails talk

Friday, March 26, 2010


Re: [Rails] auto_complete: if no results returned, what gets submitted?

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

Wim,

I just tried it out, and it works fine for me – if I type a name that doesn't exist, then that name is submitted.

In the controller:

  auto_complete_for :supplier, :name

In the action:

  render :text => "Name = #{params[:supplier][:name]}"

And in the view:

  <%= text_field_with_auto_complete :supplier, :name %>

If this doesn't help you, maybe you could post some code?

/Lasse

2010/3/25 Wim Van Dijck <google@sinoid.be>
Hi,

I'm a rails noob, tring to teach myself, so feel free to point me to
the correct FM if need be ;-)

I'm playing with the auto_complete plugin. I have a page to manage
expenses, and there's field 'supplier' to whom the expense is paid.
I can successfully retrieve the suppliers name from the suppliers
table, but when I type a name that doesn't exist yet, and submit,
nothing gets submitted?

Can anyone shed any light to why that is?
Ideally, in this situation, I'd like to be redirected to the supplier
model 'new' page, but I can settle for it just accepting what I type?

Best regards,
Wim

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.


--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment

Subscribe feeds via e-mail

Blog Archive