How can I use it with autocomplete

View: New views
7 Messages — Rating Filter:   Alert me  

How can I use it with autocomplete

by pawel-16 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I like the idee and i've used the library in some projects.
Is there a posibility to take away the js-code from the body of this
<a href="http://wiki.script.aculo.us/scriptaculous/show/
Ajax.Autocompleter">Autocompleter</a> ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Behaviour Javascript Library" group.
To post to this group, send email to behaviour@...
To unsubscribe from this group, send email to behaviour-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/behaviour?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: How can I use it with autocomplete

by Jesdisciple :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Could you please clarify your question?  I know from your title that you want to use the JavaScript at the linked page with Behaviour.  But your message seems to say that you want to strip all functioning JavaScript from the page.

(BTW, you'll want to put each of your URLs on its own line next time, without HTML tags.)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Behaviour Javascript Library" group.
To post to this group, send email to behaviour@...
To unsubscribe from this group, send email to behaviour-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/behaviour?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: How can I use it with autocomplete

by pawel-16 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Sorry,

the code example aof the autocompleter drom scriptacolus use inline -
js like
new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' }); in the
html-source. I'm looking for a way to keep it out.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Behaviour Javascript Library" group.
To post to this group, send email to behaviour@...
To unsubscribe from this group, send email to behaviour-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/behaviour?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: How can I use it with autocomplete

by Jesdisciple :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Oh, for keeping logic apart from layout.  From what I gather, that code is made to be separated.  Here's an example:

your_page.html
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <title>Titled Document</title>
        <script type="text/javascript" src="Behaviour.js"></script>
        <link rel="stylesheet" href="your_style.css">
        <script type="text/javascript" src="your_script.js"></script>
    </head>
    <body>
        <input type="text" id="autocomplete" name="autocomplete_parameter"/><div id="autocomplete_choices" class="autocomplete"></div>
    </body>
</html>

your_script.js

function main(){
    new Ajax.Autocompleter("autocomplete", "autocomplete_choices", "/url/on/server", {});
}

But as far as I know, the onload="main();" is necessary for now.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Behaviour Javascript Library" group.
To post to this group, send email to behaviour@...
To unsubscribe from this group, send email to behaviour-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/behaviour?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: How can I use it with autocomplete

by Jesdisciple :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Woops, make that:

your_page.html
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <title>Titled Document</title>
        <script type="text/javascript" src="Behaviour.js"></script>
        <link rel="stylesheet" href="your_style.css">
        <script type="text/javascript" src="your_script.js"></script>
    </head>
    <body onload="main();">
        <input type="text" id="autocomplete" name="autocomplete_parameter"/><div id="autocomplete_choices" class="autocomplete"></div>
    </body>
</html>

I forgot the onload="main();" I was talking about, lol.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Behaviour Javascript Library" group.
To post to this group, send email to behaviour@...
To unsubscribe from this group, send email to behaviour-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/behaviour?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: How can I use it with autocomplete

by Jesdisciple :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Woops again!  That first script tag should point to scriptaculous rather than Behaviour.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Behaviour Javascript Library" group.
To post to this group, send email to behaviour@...
To unsubscribe from this group, send email to behaviour-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/behaviour?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: How can I use it with autocomplete

by pawel-16 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



I found a solution. It isn't neccessary to use behavior.  I wrote a
new file search.js, with this code:

document.observe('dom:loaded', function() {
  new Ajax.Autocompleter('search', 'AutocompleteChoices',
'search.php', {
    method: 'post',
    minChars: 3,
    updateElement: function(item) { /* no update */ }
  });
});
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Behaviour Javascript Library" group.
To post to this group, send email to behaviour@...
To unsubscribe from this group, send email to behaviour-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/behaviour?hl=en
-~----------~----~----~----~------~----~------~--~---