Auto Complete using tex input

I have to use the auto complete but i cant use the
text_field_with_auto_complete. i have to use it with a standard input
text box. Can someone help me with what javascript to embed to enable it
to work.

On Dec 7, 2007, at 5:41 PM, Neha C. wrote:

I have to use the auto complete but i cant use the
text_field_with_auto_complete. i have to use it with a standard input
text box. Can someone help me with what javascript to embed to
enable it
to work.

You are done, text_field_with_auto_complete uses a standard text
field :-).

– fxn

But i cant use the tag directly.
I want to use it this way

and i dont know what javascript to pass so that observer gets fired and
all.
Please help.

Xavier N. wrote:

On Dec 7, 2007, at 5:41 PM, Neha C. wrote:

I have to use the auto complete but i cant use the
text_field_with_auto_complete. i have to use it with a standard input
text box. Can someone help me with what javascript to embed to
enable it
to work.

You are done, text_field_with_auto_complete uses a standard text
field :-).

– fxn

On Dec 7, 2007, at 9:25 PM, Neha C. wrote:

But i cant use the tag directly.
I want to use it this way

and i dont know what javascript to pass so that observer gets fired
and
all.

This is a starting point, where each component is more or less self-
explanatory:

 return <<-HTML
   #{auto_complete_stylesheet unless

completion_options[:skip_style]}
#{text_field_tag tf_name, tf_value, tag_options}
#{content_tag(“div”, “”, :id =>
“#{tf_id}_auto_complete”, :class => “auto_complete”)}
#{auto_complete_field tf_id, completion_options}
HTML

You create custom HTML elements, and after that delegate in
auto_complete_field.

– fxn

Hi,

What will completion_options[:skip_style] be?

I have implemented it like

<%=content_tag(“div”, “”, :id =>"#{@data_elem.id}_auto_complete", :class
=> “auto_complete”) %>
<%=auto_complete_field @data_elem.id%>

and i am getting missing variable name an error in prototype.js.

Xavier N. wrote:

On Dec 7, 2007, at 9:25 PM, Neha C. wrote:

But i cant use the tag directly.
I want to use it this way

and i dont know what javascript to pass so that observer gets fired
and
all.

This is a starting point, where each component is more or less self-
explanatory:

 return <<-HTML
   #{auto_complete_stylesheet unless

completion_options[:skip_style]}
#{text_field_tag tf_name, tf_value, tag_options}
#{content_tag(“div”, “”, :id =>
“#{tf_id}_auto_complete”, :class => “auto_complete”)}
#{auto_complete_field tf_id, completion_options}
HTML

You create custom HTML elements, and after that delegate in
auto_complete_field.

– fxn

On Dec 10, 2007, at 6:29 PM, Neha C. wrote:

What will completion_options[:skip_style] be?

Please ignore that line, it says: inline the CSS for auto completion
unless specified otherwise[*]. You probably want an external CSS for
this stuff anyway.

I have implemented it like

<%=content_tag(“div”, “”, :id
=>"#{@data_elem.id}_auto_complete", :class

Instead of @data_elem.id you need to use the ID of the text field.

=> “auto_complete”) %>
<%=auto_complete_field @data_elem.id%>

Same here.

– fxn

[*] That code was copied from a helper of
http://agilewebdevelopment.com/plugins/model_auto_completer
that receives a hash of options called completion_options.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs