# Newbie Question on the Basics

**URL:** <https://www.ruby-forum.com/t/newbie-question-on-the-basics/112293>\
**Category:** Ruby\
**Created:** [August 17, 2007, 4:19am UTC](https://www.ruby-forum.com/t/newbie-question-on-the-basics/112293 "2007-08-17T04:19:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vik\_r](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f05b48/32.png) [@vik\_r](https://www.ruby-forum.com/u/vik_r)\
**Post date:** [August 17, 2007, 4:19am UTC](https://www.ruby-forum.com/t/newbie-question-on-the-basics/112293/1 "2007-08-17T04:19:12Z")

</div>

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

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’);?\>"\>

  
Search by metal name   
  
  

  

  
  

  

Enter your function above

  

 \<?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

---

<div class="post-metadata">

**Author:** ![vik\_r](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f05b48/32.png) [@vik\_r](https://www.ruby-forum.com/u/vik_r)\
**Post date:** [August 17, 2007, 5:05am UTC](https://www.ruby-forum.com/t/newbie-question-on-the-basics/112293/2 "2007-08-17T05:05:51Z")

</div>

On Aug 16, 9:19 pm, Vik R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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/scriptaculous/](http://wiki.script.aculo.us/scriptaculous/)).

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

[http://www.ruby-forum.com/forum/10](http://www.ruby-forum.com/forum/10)

Good luck.

Gordon
