[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Newbie Question on the Basics

Vik Rubenfeld

8/17/2007 2:19:00 AM

(I hope I'm in the right forum. This is the site linked to as the forum
for Scriptaculous - http://wiki.script.aculo.us/scri...).

I have a total newbie question. I'm studying a sample application that
uses Scriptaculous for Autocomplete. It does this by putting the
following into the header of the web page:

----------
window.onload = function () {

new Ajax.Autocompleter("metal_name", "autocomplete_choices",
base_url+"add_metals/ajaxsearch/", {});

$('metal_search_form').onsubmit = function () {
inline_results();
return false;
}
}
----------

And here's the HTML:

----------
<?php
$this->load->view("header");
?>
<h2><?= $title;?></h2>
<form id="metal_search_form" method="post" action="<?=
site_url('add_metals/ajaxsearch');?>">
<div>
<label for="metal_name">Search by metal name </label>
<input type="text" name="metal_name" id="metal_name" />
<input type="submit" value="search" id="search_button" />
<div id="autocomplete_choices" class="autocomplete"></div>
</div>
</form>
<div id="metal_description" style="display:none;">
<p>Enter your function above</p>
</div>

<?php
$this->load->view("footer");
?>
----------

Here are my questions:

1) I don't see anything in the HTML that calls the JavaScript. What is
it in the HTML that calls the Javascript?

2) Autocomplete has to work by calling a function after every keypress.
What is it in the HTML that calls the Javascript after every keypress?

I guess those are both the same question.

Thanks very much in advance to all for any info!


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

1 Answer

Gordon Thiesfeld

8/17/2007 3:04:00 AM

0

On Aug 16, 9:19 pm, Vik Rubenfeld <v...@mindspring.com> wrote:
> (I hope I'm in the right forum. This is the site linked to as the forum
> for Scriptaculous -http://wiki.script.aculo.us/scri...).

While someone might be able to help you here, you'll probably have
better luck in the rails spinoffs forum.

http://www.ruby-forum.co...

Good luck.

Gordon