473,604 Members | 2,483 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

prototype autocompleter 2 variables

Hi, I'm trying to have two input field ie:

who |mickey mouse| <- value is "mickey mouse"

when |12...|
|12-5-2005|


they work perfectly, but i'd like to have the variable i've previously
chosed in one of the input field sent along the new one i'm writing.
in this case, i'd like to send "12" with the variable $who setted lile
"mickey mouse"

in this way i could suggest related stuff.

couldn't find a solution, do you have any idea?

Thank you

--
Vedo gli amici ancora sulla strada, loro non hanno fretta,
rubano ancora al sonno l'allegria all'alba un po' di notte:
e poi la luce, luce che trasforma il mondo in un giocattolo.
Faremo gli occhiali così, Faremo gli occhiali così!
Mar 14 '06 #1
14 2830
Motion Musso aka: Sathia wrote:
Hi, I'm trying to have two input field ie:

who |mickey mouse| <- value is "mickey mouse"

when |12...|
|12-5-2005| ^^^^^^^^^^^^^^^ ^
they work perfectly, but i'd like to have the variable i've previously ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^ chosed in one of the input field sent along the new one i'm writing. ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^ in this case, i'd like to send "12" with the variable $who setted lile ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ "mickey mouse" ^^^^^^^^^^^^^^ in this way i could suggest related stuff.

couldn't find a solution, do you have any idea?


Parse error (after three passes). Please restate your request.
PointedEars
Mar 14 '06 #2
Thomas 'PointedEars' Lahn wrote:
Parse error (after three passes). Please restate your request.


yes, i know there are old fart at play between parser, nevermind, i don't
care about netscape 4 or this kind of comments
PointedEars


--
Vedo gli amici ancora sulla strada, loro non hanno fretta,
rubano ancora al sonno l'allegria all'alba un po' di notte:
e poi la luce, luce che trasforma il mondo in un giocattolo.
Faremo gli occhiali così, Faremo gli occhiali così!
Mar 14 '06 #3
Thomas 'PointedEars' Lahn wrote:
Parse error (after three passes). Please restate your request.

you can guess yourself i'm not english or american

btw if you can help i will do my best to re-post the thread at the best of
my poor english.

PointedEars


--
Vedo gli amici ancora sulla strada, loro non hanno fretta,
rubano ancora al sonno l'allegria all'alba un po' di notte:
e poi la luce, luce che trasforma il mondo in un giocattolo.
Faremo gli occhiali così, Faremo gli occhiali così!
Mar 14 '06 #4
motion musso aka: sathia wrote:
Thomas 'PointedEars' Lahn wrote:
Parse error (after three passes). Please restate your request.


yes, i know there are old fart at play between parser, nevermind, i don't
care about netscape 4 or this kind of comments


You missed the point.
PointedEars
Mar 14 '06 #5
motion musso aka: sathia wrote:
Thomas 'PointedEars' Lahn wrote:
Parse error (after three passes). Please restate your request.
^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^ you can guess yourself i'm not english or american
I am not either.
btw if you can help i will do my best to re-post the thread at
the best of my poor english.


If you wish to be helped, please do so, as I asked already.
PointedEars
Mar 14 '06 #6
Thomas 'PointedEars' Lahn wrote:
motion musso aka: sathia wrote:
btw if you can help i will do my best to re-post the thread at
the best of my poor english.


If you wish to be helped, please do so, as I asked already.


To avoid a misunderstandin g: Do not re-post! Ever.
Restate your request within _this_ thread instead.
PointedEars
Mar 14 '06 #7
Thomas 'PointedEars' Lahn wrote:

btw if you can help i will do my best to re-post the thread at
the best of my poor english.
If you wish to be helped, please do so, as I asked already.


ok. the point is:

i have a page with a form, in this form there are 2 "input text" field.
i want to give the user an autocompletion div on each of them.

obviously each autocompletion div refers to a different server side page.
ie:

who |venus| => who.php

when |2006-[...]| => when.php

let's suppose that the user has selected "venus" from the suggested list.

i'd like to let know the "when.php" page to look only records that are both
of "venus" and start with "2006-"

obviously this has to work in each direction, who => when || when => who

i can't explain myself any better than this.
i'm sorry for my poor english.

regards

PointedEars


Sathia

--
Vedo gli amici ancora sulla strada, loro non hanno fretta,
rubano ancora al sonno l'allegria all'alba un po' di notte:
e poi la luce, luce che trasforma il mondo in un giocattolo.
Faremo gli occhiali così, Faremo gli occhiali così!
Mar 14 '06 #8
motion musso aka: sathia wrote:

i can't explain myself any better than this.
i'm sorry for my poor english.


var answer = undefined;

:P

--
Vedo gli amici ancora sulla strada, loro non hanno fretta,
rubano ancora al sonno l'allegria all'alba un po' di notte:
e poi la luce, luce che trasforma il mondo in un giocattolo.
Faremo gli occhiali così, Faremo gli occhiali così!
Mar 14 '06 #9
motion musso aka: sathia wrote:
Thomas 'PointedEars' Lahn wrote:
btw if you can help i will do my best to re-post the thread at
the best of my poor english. If you wish to be helped, please do so, as I asked already.


ok. the point is:

i have a page with a form, in this form there are 2 "input text" field.
i want to give the user an autocompletion div on each of them.

obviously each autocompletion div refers to a different server side page.
ie:

who |venus| => who.php

when |2006-[...]| => when.php

let's suppose that the user has selected "venus" from the suggested list.

i'd like to let know the "when.php" page to look only records that are
both of "venus" and start with "2006-"

obviously this has to work in each direction, who => when || when => who


You better use only one server-side script. On change of either text input
control, or on submit of the form, use the value of each control as request
parameter. On submit:

<form action="whateve r.php">
<input name="who">
<input name="when">
...
</form>

To facilitate this on change of either text input control, you will have to
make an XML HTTP request. Quickhack:

<form action="whateve r.php" onchange="makeR equest(this);">
<script type="text/javascript">
/**
* @author
* (C) 2003, 2004 Thomas Lahn &lt;ty******@Po intedEars.de&gt ;
* Distributed under the GNU GPL v2.
* @partof
* http://pointedears.de/scripts/types.js
* @optional string s
* String to be determined a method type, i.e. "object"
* in IE, "function" otherwise. The type must have been
* retrieved with the `typeof' operator, thus this method
* is applicable to unknown properties while
* @link{#isMethod ()} is not. Note that this method
* may also return <code>true</code> if the value of
* the <code>typeof</code> operand is <code>null</code>; to
* be sure that the operand is a method reference, you have
* to && (AND)-combine the <code>isMethodT ype(...)</code>
* expression with the method reference identifier.
* @return type boolean
* <code>true</code> if <code>s</code> is a method type,
* <code>false</code> otherwise.
* @see #isMethod()
*/
function isMethodType(s)
{
return (s == "function" || s == "object");
}

/**
* Tries hard to escape a string according to the query component
* specification in RFC3986.
*
* @author Copyright (c) 2006
* Thomas Lahn &lt;st*******@P ointedEars.de&g t;
* Distributed under the GNU GPL v2.
* @partof
* http://pointedears.de/scripts/string.js
* @param s: string
* @return type string
* <code>s</code> escaped, or unescaped if escaping through
* <code>encodeURI Component()</code> or <code>escape( )</code>
* is not possible.
*/
function esc(s)
{
return (isMethodType(t ypeof encodeURICompon ent)
? encodeURICompon ent(s)
: (isMethodType(t ypeof escape)
? escape(s)
: s));
}

function makeRequest(f)
{
var
query = [],
m = (f.method && f.method.toUppe rCase()) || "GET";

for (var i = 0, es = f.elements, len = es && es.length;
i < len;
i++)
{
var e = es[i];
if (e.type.toLower Case() == "text")
{
if (i > 0) query.push("&") ;
query.push(esc( e.name) + "=" + esc(e.value));
}
}
query = query.join("");

var x = new XMLHttpRequest( );
x.open(m, f.action + ((m == "GET") ? ("?" + query) : ""));

if (isMethodType(t ypeof x.setRequestHea der))
{
x.setRequestHea der("Content-Type",
"applicatio n/x-www-url-encoded");
}

x.onreadystatec hange = function()
{
if (x.readyState == 4 && /^[02]/.test(x.status) )
{
changeContentOf DivElement();
displayDivEleme nt();
}
}

x.send((m != "GET") ? query : null);
}
</script>
<div>
<input name="who">
<input name="when">
</div>
...
</form>

The `change' event should bubble, therefore it could be handled by an
ancestor element, in this case the `form' element.

See also Google Suggest: <URL:http://www.google.com/webhp?complete= 1>
i can't explain myself any better than this.
i'm sorry for my poor english.


It was much better now. (Just remember that the pronoun is spelled "I"
always, and that sentences usually start with a capital letter, as in
many other languages, including your native one.)
HTH

PointedEars
Mar 14 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3745
by: Elf M. Sternberg | last post by:
One of the complaints about prototype.js (google for it if you're not familiar with it) is that it's poorly documented. I have this inkling that the key to understanding prototype.js is in the bind function. The problem with Javascript is that the "this" operator is poorly overloaded and it is often hard to understand in the context of object-oriented javascript So, let's start with the definition:
13
4335
by: Roy Hills | last post by:
I've seen two different function prototype formats used for ANSI C, and I'm unsure as to which is the correct or preferred one. 1st Format (this is what I use) type function(type, type, type); e.g. "int multiply(int, int);" 2nd Format (I've seen this used in other people's code)
4
2225
by: jemptymethod | last post by:
http://htmatters.net/htm/1/2006/01/EIBTI-for-Javascript-explicit-is-better-than-implicit.cfm
13
2549
by: eman1000 | last post by:
I was recently looking at the prototype library (http://prototype.conio.net/) and I noticed the author used the following syntax: Object.extend(MyObj.prototype, { my_meth1: function(){}, my_meth2: function(){} }); to define new methods on the MyObj prototype object. Object.extend
2
2346
by: vlsidesign | last post by:
Here is my a portion of my program: #include <stdio.h> main() { int fahr, celsius; int lower, upper, step; int fc_conv(int fahr); ... snip ... }
7
1977
by: Sheldon | last post by:
Hi, This is a simple mistake so Iam sure there is someone who can help with it: The the file.h: #define IBFLEN 50000 int IRET, ILEN, IUNIT1, IUNIT2, ILOOP, KERR;
83
4156
by: liketofindoutwhy | last post by:
I am learning more and more Prototype and Script.aculo.us and got the Bungee book... and wonder if I should get some books on jQuery (jQuery in Action, and Learning jQuery) and start learning about it too? Once I saw a website comparing Prototype to Java and jQuery to Ruby... but now that I read more and more about Prototype, it is said that Prototype actually came from Ruby on Rails development and the creator of Prototype created it...
0
7997
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7929
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8409
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8065
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6739
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5882
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3907
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3955
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1266
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.