[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Auto Complete using tex input

Neha Chopra

12/7/2007 4:41:00 PM

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.
--
Posted via http://www.ruby-....

13 Answers

Xavier Noria

12/7/2007 8:21:00 PM

0

On Dec 7, 2007, at 5:41 PM, Neha Chopra 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


Neha Chopra

12/7/2007 8:25:00 PM

0

But i cant use the tag directly.
I want to use it this way
<input type="text" id="criteria[<%=count%>][data_autocomplete]"
name="criteria[<%=count%>][data_autocomplete]" size="60"
autocomplete="on"/>

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

Xavier Noria wrote:
> On Dec 7, 2007, at 5:41 PM, Neha Chopra 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

--
Posted via http://www.ruby-....

Xavier Noria

12/7/2007 10:05:00 PM

0

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

> But i cant use the tag directly.
> I want to use it this way
> <input type="text" id="criteria[<%=count%>][data_autocomplete]"
> name="criteria[<%=count%>][data_autocomplete]" size="60"
> autocomplete="on"/>
>
> 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


Neha Chopra

12/10/2007 5:29:00 PM

0

Hi,

What will completion_options[:skip_style] be?

I have implemented it like
<input type="text" id="criteria[<%=count%>][data_autocomplete]"
name="criteria[<%=count%>][data_autocomplete]" size="60"
autocomplete="off"/>
<%=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 Noria wrote:
> On Dec 7, 2007, at 9:25 PM, Neha Chopra wrote:
>
>> But i cant use the tag directly.
>> I want to use it this way
>> <input type="text" id="criteria[<%=count%>][data_autocomplete]"
>> name="criteria[<%=count%>][data_autocomplete]" size="60"
>> autocomplete="on"/>
>>
>> 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

--
Posted via http://www.ruby-....

Xavier Noria

12/10/2007 6:15:00 PM

0

On Dec 10, 2007, at 6:29 PM, Neha Chopra 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
> <input type="text" id="criteria[<%=count%>][data_autocomplete]"
> name="criteria[<%=count%>][data_autocomplete]" size="60"
> autocomplete="off"/>
> <%=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...
that receives a hash of options called completion_options.


nusratrizvi130

2/28/2012 1:49:00 PM

0

On Mon, 27 Feb 2012 10:55:36 -0500, "John" <JohnDM@meritus.com> wrote:

>baldeagle wrote:
>> I know all I blab all
>> I am madly in love with myself
>
>You're a top-poster too :-)
>
>>
>> On Sun, 26 Feb 2012 18:26:31 -0800 (PST), baldeagle
>> <force.sin@gmail.com> wrote:
>>
>>> In an election campaign, the support for a candidate can be measured
>>> by the crowd at the events held...by the candidate to promote his
>>> candidacy.
>>>
>>> Mitt Romney expected a huge crowd who will come listen to him in
>>> Detroit...he booked a football stadium which can hold 80,000 people.
>>> Less than 200 people came !!!
>>> Obama held a recent event in a football stadium...it was filled to
>>> capacity...and many had to be turned away.
>>>
>>> Journalists who followed Mitt Romney on his campaign trails....cannot
>>> helped but notice that the crowd is getting smaller and smaller.
>>>
>>> This is worrying to the Republican establishment...their favorite son
>>> is NOT popular among the Americans...the 99% crowd. The super PACs
>>> can spend millions on negative ads to destroy Romney's opposition one
>>> after another...but they cannot make him popular among the
>>> people...the American voters.

Seems only you are capable of performing this miracle.

baldeagle

2/29/2012 2:12:00 AM

0

http://www.guardian.co.uk/world/2012/feb/24/mitt-romney-economic-speech-falls-fl...

An EMPTY football stadium....how humiliating for Mitt Romney.

Why ? Why the empty stadium!!!

Mitt Romney belong to the fat cat class...the 1 percent-er
He casually bet $10,000 during the TV debate...he boast
that his wife drives TWO Cadillacs....he wears jeans as if
he is wearing executive pants... He tried to project a working
class image ...but every ninety-niner can see that he is phoney....

If Mitt Romey win the GOP primary.... he is easy meat for Obama.

rst0wxyz

2/29/2012 3:04:00 AM

0

On Feb 28, 6:12 pm, baldeagle <force....@gmail.com> wrote:
> http://www.guardian.co.uk/world/2012/feb/24/mitt-romney-eco......
>
> An EMPTY football stadium....how humiliating for Mitt Romney.
>
> Why ?  Why the empty stadium!!!
>
> Mitt Romney belong to the fat cat class...the 1 percent-er
> He casually bet $10,000 during the TV debate...he boast
> that his wife drives TWO Cadillacs....he wears jeans as if
> he is wearing executive pants... He tried to project a working
> class image ...but every ninety-niner can see that he is phoney....
>
> If Mitt Romey win the GOP primary.... he is easy meat for Obama.

But if he can make $42 million dollars in two bad years, I'm for him.
Maybe he can make $42 trillion trillion dollars for America in two
years.

baldeagle

2/29/2012 4:36:00 AM

0

I know all

On Tue, 28 Feb 2012 18:12:20 -0800 (PST), baldeagle
<force.sin@gmail.com> wrote:

>http://www.guardian.co.uk/world/2012/feb/24/mitt-romney-economic-speech-falls-fl...
>
>An EMPTY football stadium....how humiliating for Mitt Romney.
>
>Why ? Why the empty stadium!!!
>
>Mitt Romney belong to the fat cat class...the 1 percent-er
>He casually bet $10,000 during the TV debate...he boast
>that his wife drives TWO Cadillacs....he wears jeans as if
>he is wearing executive pants... He tried to project a working
>class image ...but every ninety-niner can see that he is phoney....
>
>If Mitt Romey win the GOP primary.... he is easy meat for Obama.

baldeagle

2/29/2012 4:36:00 AM

0

On Feb 29, 11:03 am, rst0 <rst0w...@yahoo.com> wrote:
> On Feb 28, 6:12 pm, baldeagle <force....@gmail.com> wrote:
>
> >http://www.guardian.co.uk/world/2012/feb/24/mitt-romney-eco......
>
> > An EMPTY football stadium....how humiliating for Mitt Romney.
>
> > Why ?  Why the empty stadium!!!
>
> > Mitt Romney belong to the fat cat class...the 1 percent-er
> > He casually bet $10,000 during the TV debate...he boast
> > that his wife drives TWO Cadillacs....he wears jeans as if
> > he is wearing executive pants... He tried to project a working
> > class image ...but every ninety-niner can see that he is phoney....
>
> > If Mitt Romey win the GOP primary.... he is easy meat for Obama.
>
> But if he can make $42 million dollars in two bad years, I'm for him.
> Maybe he can make $42 trillion trillion dollars for America in two
> years.

Precisely...Thousands of Wall streets investors...earn more
than 42 millions a year....and pay lower tax... capital gain tax.
Mitt Romney belong to the 1 percent Wall Street rich millionaire
club.
Wall street investors are high risk takers (not unlike casino
gamblers).. they are NOT job creators in the main street.. NOT
entrepreneurs running small and medium size businesses.

Mitt Romney supported Obama's trillion dollar stimulus package
in saving Wall Street and banks...is proof that he is NO better
then Obama.
Mitt Romney does NOT know how to grow the real economy in
main-street USA. He is the wrong man...if you are looking
for someone to save the REAL US economy.