views:

134

answers:

2

Hey guys,

I'm very verrry new to rails.

I'm using the autocomplete (plugin) text field to browse through titles of my records. When the user selects the record, I'd like to forward them to a custom built URL, based on that record's ID.

How should I do this?

Thanks!

-Elliot

To be more specific. I'm trying to make a simple search form, that redirects right to the record filled in by the autocomplete. If the record does not exist, I'd either like a message saying it doesn't yet exist, or a create record page.

UPDATE:

This may be more helpful, how can I just grab the value currently in the text box?

A: 

I think what you are referring to is directing to a page like "/record/my_awesome_product" rather than the boring "/record/1234".

Although this article is a little outdated (in Rails development terms) it still may help you.

askegg
actually, I'm fine with directing to record/1234
Elliot
+1  A: 

The auto-complete plugin you are using may not be the best for you to use. Here is another option for you to consider:

Model Auto Completer

  • This plugin returns the text, but also stores the id in a hidden field.

There was another plugin I thought that did this as well, I can't remember it now though.

Ryan
how is it grabbing the value of the textbox?
Elliot
re-read your problem, edited my answer.
Ryan