473,799 Members | 3,390 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

missing ] after element list

I am attempting to populate a few select drop down menus from the
selection of the first drop down. I am using ajax to submit data via a
PHP GET and from the response populate the other drop down menus.

I figured out how to get it to do so for more than one drop down, but I
am getting the following error below. This was working fine until I
tried to populate more than one other drop down menu. Any idea why the
SELECT object isn't being passed? It seems so close.

Thanks,
Pasquale
*** begin error ***
missing ] after element list
GetInfo([object HTMLSelectEleme nt],1,"Color") Line 82
-----------------|
*** end error ***

*** begin JavaScript snip ***
var attr;
var attrarray = new Array (
'Color','Type'
);
function InfoLoop (sel,selset) {
for (var i = 0; i < attrarray.lengt h; i++) {
attr = attrarray[i];
setTimeout('Get Info('+sel+','+ selset+',"'+att r+'")',2000); //Line 82
}
}
*** end JavaScript snip ***

*** begin HTML snip ***
<SELECT id="Collection_ 1" name="Collectio n_1" size="1"
onChange="InfoL oop(this,1)">
*** end HTML snip ***
Jun 23 '07 #1
4 10691
Lee
Pasquale said:
>
I am attempting to populate a few select drop down menus from the
selection of the first drop down. I am using ajax to submit data via a
PHP GET and from the response populate the other drop down menus.

I figured out how to get it to do so for more than one drop down, but I
am getting the following error below. This was working fine until I
tried to populate more than one other drop down menu. Any idea why the
SELECT object isn't being passed? It seems so close.

Thanks,
Pasquale
*** begin error ***
missing ] after element list
GetInfo([object HTMLSelectEleme nt],1,"Color") Line 82
-----------------|
*** end error ***

*** begin JavaScript snip ***
var attr;
var attrarray = new Array (
'Color','Type'
);
function InfoLoop (sel,selset) {
for (var i = 0; i < attrarray.lengt h; i++) {
attr = attrarray[i];
setTimeout('Get Info('+sel+','+ selset+',"'+att r+'")',2000); //Line 82
}
}
*** end JavaScript snip ***

*** begin HTML snip ***
<SELECT id="Collection_ 1" name="Collectio n_1" size="1"
onChange="Info Loop(this,1)">
*** end HTML snip ***
You're passing a reference to the Select object into infoLoop(),
and inside that function you're using that argument in a string
concatination. In order to do that, Javascript uses the value
of the Select object's toString() method, which seems to be
"[object HTMLSelectEleme nt]".

Instead of passing a reference to the Select, pass its id value,
which can safely be concatinated into a string. You'll also
have to make changes to infoLoop() and GetInfo() so they treat
the value correctly.
--

Jun 23 '07 #2
Lee
Lee said:
>You're passing a reference to the Select object into infoLoop(),
and inside that function you're using that argument in a string
concatinatio n. In order to do that, Javascript uses the value
of the Select object's toString() method, which seems to be
"[object HTMLSelectEleme nt]".

Instead of passing a reference to the Select, pass its id value,
which can safely be concatinated into a string. You'll also
have to make changes to infoLoop() and GetInfo() so they treat
the value correctly.
I find it really annoying that, after all these years of
using the word, my fingers still haven't learned to spell
"concatenat e" correctly.
--

Jun 23 '07 #3
Lee wrote:
Lee said:
>You're passing a reference to the Select object into infoLoop(),
and inside that function you're using that argument in a string
concatinatio n. In order to do that, Javascript uses the value
of the Select object's toString() method, which seems to be
"[object HTMLSelectEleme nt]".

Instead of passing a reference to the Select, pass its id value,
which can safely be concatinated into a string. You'll also
have to make changes to infoLoop() and GetInfo() so they treat
the value correctly.

I find it really annoying that, after all these years of
using the word, my fingers still haven't learned to spell
"concatenat e" correctly.
Hahaha. I thank the Mozilla gods everyday for Thunderbirds "spell check
as you type" feature.

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Jun 23 '07 #4
Lee wrote:
>>
*** begin JavaScript snip ***
var attr;
var attrarray = new Array (
'Color','Type'
);
function InfoLoop (sel,selset) {
for (var i = 0; i < attrarray.lengt h; i++) {
attr = attrarray[i];
setTimeout('Get Info('+sel+','+ selset+',"'+att r+'")',2000); //Line 82
}
}
*** end JavaScript snip ***

*** begin HTML snip ***
<SELECT id="Collection_ 1" name="Collectio n_1" size="1"
onChange="Info Loop(this,1)">
*** end HTML snip ***

You're passing a reference to the Select object into infoLoop(),
and inside that function you're using that argument in a string
concatination. In order to do that, Javascript uses the value
of the Select object's toString() method, which seems to be
"[object HTMLSelectEleme nt]".

Instead of passing a reference to the Select, pass its id value,
which can safely be concatinated into a string. You'll also
have to make changes to infoLoop() and GetInfo() so they treat
the value correctly.
Thanks! That is fixed, but now the ' attr = attrarray[i]; ' is
processing before the return of the PHP data. So the options are put
into the second of the attributes drop down instead of the first.

Thinking about, it would probably be better to wait until
the return of the PHP data is done and then have attr = attrarray[i];
process.

But out of curiousity, can I setTimeout to ' attr = attrarray[i]; ' to
have it pause for a second?

>
Jun 24 '07 #5

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

Similar topics

12
2244
by: Antoon Pardon | last post by:
Well at least I find them missing. For the moment I frequently come across the following cases. 1) Two files, each with key-value pairs for the same dictionary. However it is an error if the second file contains a key that was not in the first file. In treating the second file I miss a 'set' method. dct.set(key, value) would be equivallent to dct = value,
1
18514
by: soup_or_power | last post by:
I'm passing the return from window.open as a function argument and getting the error "missing ] after element list" when tested with FireFox. Here is the relevant code. Many thanks for your help. function blurCkbox(num, disp, but_id, sugg) { if (num == 1) { eval("self.opener.document.forms." + but_id + ".value=\'" + sugg + "\'");
6
8349
by: David B. Bitton | last post by:
I am having a problem deserializing XML when the root node is missing a namespace declaration. My Type has an XmlTypeAttribute with a namespace defined. If I attempt to deserialize the XML, I get the dreaded <elementname xmlns=''> was not expected exception. If I comment out the XmlTypeAttribute, it works just fine. Just so you know, when I instantiate an instance of an XmlSerializer, I pass a default namespace to the ctor. ...
69
16900
by: markarichman | last post by:
Why is Firefox complaining with this error: ------------------------------------------------------------ missing ) after argument list setTimeout('breakOut',5000); ------------------------------------------------------------ Here is the HTML that I'm producing:
0
2132
by: chris | last post by:
For reasons I rather not go into, I'm looking to generate a type of "list of xs:ID" think of of them as aliases with XSV I can get round to acually entering a list but they are not recognised as ID just NMTOKENS and when I use them I get ID not declared What am I missing? I generated a little example using inline schemas, to show the issue. Don't even try to use XMLSpy 1) No inline support 2) will not cope with <xs:simpleType>
4
9830
by: eksamor | last post by:
I have a simple linked list: struct element { struct element *next; int start; }; struct list { struct element *head;
2
498
by: inventor | last post by:
I'm doing programming for my science prodject, and when I was programming (I'm building an alphebatizer) I ran into this bug: I've got an input box, but no button or output box. so I do some reaserch, insert a button, and when I open it up, instead of the button being added, I lost the input box. Can ANYONE PLEASE HELP ME!!!!!!!!!!!!! I've included a copy of my code as it is: <HTML> <HEAD> Riehl's Alphebatizer <SCRIPT...
2
2886
by: Scott Emick | last post by:
I am still having issues with getting Root Element Missing instead of the actual error that the webservice call is supposed to be returning. I'm using VB .Net 2003. Has anyone else been able to get around what seems like a bug in the dotnet framework? Scott Emick
15
2738
by: caca | last post by:
Hello, This is a question for the best method (in terms of performance only) to choose a random element from a list among those that satisfy a certain property. This is the setting: I need to pick from a list a random element that satisfies a given property. All or none of the elements may have the property. Most of the time, many of the elements will satisfy the property, and the property is a bit expensive to evaluate. Chance of...
0
9687
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
9543
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
10257
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...
0
10029
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9077
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...
0
5588
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4144
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3761
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
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.