Hello dear Newsgroup,
my problem seems somehow silly, but after some googeling, I don't find
a solution. The point is:
I have an multiple select field to which I add values using some
JavaScript. As I am willing to use all the values in a later PHP
processor, I have to call these select fields like name[] and before
submitting, I have to mark every item (JavaScript as well)
But it seems, which is in some way logical to me, as if the javascript
doesn't want to process variables like name[] as it probably threads it
like an array, which it isn't (at least not in that context). Using
name\[\] won't work either.
What could work?
To give a small sneak of what I am doing, check http://gosingen.dyndns.tv/sura/1/programm/addmovie.php but note that
there is still a lot of mess to be cleant, the programming proably
looks disgusting to you. It is :)
thanks in advance
Thorben 10 1513
Thorben Grosser wrote: Hello dear Newsgroup,
my problem seems somehow silly, but after some googeling, I don't find a solution. The point is: I have an multiple select field to which I add values using some JavaScript. As I am willing to use all the values in a later PHP processor, I have to call these select fields like name[] and before submitting, I have to mark every item (JavaScript as well) But it seems, which is in some way logical to me, as if the javascript doesn't want to process variables like name[] as it probably threads it like an array, which it isn't (at least not in that context). Using name\[\] won't work either. What could work?
If you have form controls that you want to have names that include
square brackets, they might look something like:
<form name="blahForm" action="">
<select name="blahSelec t[]">
...
Then you can access them using:
var theSelect = document.forms['blahForm'].elements['blahSelect[]'];
Read the FAQ on using square brackets:
<URL:http://www.jibbering.c om/faq>
[...]
--
Rob
Thorben Grosser wrote in news:1135853254 .064098.260210
@g44g2000cwa.go oglegroups.com in comp.lang.javas cript: Hello dear Newsgroup,
my problem seems somehow silly, but after some googeling, I don't find a solution. The point is: I have an multiple select field to which I add values using some JavaScript. As I am willing to use all the values in a later PHP processor, I have to call these select fields like name[] and before submitting, I have to mark every item (JavaScript as well) But it seems, which is in some way logical to me, as if the javascript doesn't want to process variables like name[] as it probably threads it like an array, which it isn't (at least not in that context). Using name\[\] won't work either. What could work?
To give a small sneak of what I am doing, check http://gosingen.dyndns.tv/sura/1/programm/addmovie.php but note that there is still a lot of mess to be cleant, the programming proably looks disgusting to you. It is :)
You possibly need to use strings (as aposed to identifiers) to
access you form elements:
var myelememnt = document.forms['myformname'].elements['item[]'];
The above is the most explicit way of accessig a form element, but:
var myelememnt = document.forms['myformname']['item[]'];
and
var myelememnt = document.myform name['item[]'];
should work too.
Rob.
-- http://www.victim-prime.dsl.pipex.com/
Works perfect, thanks to both of you :)
have a nice time
Thorben
Thorben Grosser wrote: Hello dear Newsgroup,
my problem seems somehow silly, but after some googeling, I don't find a solution. The point is: I have an multiple select field to which I add values using some JavaScript. As I am willing to use all the values in a later PHP processor, I have to call these select fields like name[] and before submitting, I have to mark every item (JavaScript as well) But it seems, which is in some way logical to me, as if the javascript doesn't want to process variables like name[] as it probably threads it like an array, which it isn't (at least not in that context). Using name\[\] won't work either. What could work?
Any JavaScript literal can be represented upon ECMA-262 chapters which
you should be able to spell alive, drunk or dead. At the very least
ECMA-262 : Book Of Source is the must. So in your case:
"[" is \u005B
"]" is \u005D
where both are in "Base Latin" Unicode table.
so
var foo\u005B\u005D = 'bar';
is the equivalent of foo[] = 'bar' *in the way you're looking for*.
VK wrote:
<snip> Any JavaScript literal can be represented upon ECMA-262 chapters which you should be able to spell alive, drunk or dead. At the very least ECMA-262 : Book Of Source is the must. So in your case: "[" is \u005B "]" is \u005D where both are in "Base Latin" Unicode table.
so
var foo\u005B\u005D = 'bar';
is the equivalent of foo[] = 'bar' *in the way you're looking for*.
Pure bullshit!
<quote cite="ECMA 262, 3rd edition; Section 7.6">
....
A UnicodeEscapeSe quence cannot be used to put a character into an
identifier that would otherwise be illegal. In other words, if a
\UnicodeEscapeS equence sequence were replaced by its
UnicodeEscapeSe quence's CV, the result must still be a valid Identifier
that has the exact same sequence of characters as the original
Identifier.
....
</quote>
It would save everyone a great deal of time and trouble if you would do
something about learning javascript prior to pontificating on the
subject.
Richard.
On 2005-12-29, VK <sc**********@y ahoo.com> wrote: Thorben Grosser wrote: Hello dear Newsgroup,
my problem seems somehow silly, but after some googeling, I don't find a solution. The point is: I have an multiple select field to which I add values using some JavaScript. As I am willing to use all the values in a later PHP processor, I have to call these select fields like name[] and before submitting, I have to mark every item (JavaScript as well) But it seems, which is in some way logical to me, as if the javascript doesn't want to process variables like name[] as it probably threads it like an array, which it isn't (at least not in that context). Using name\[\] won't work either. What could work?
Any JavaScript literal can be represented upon ECMA-262 chapters which you should be able to spell alive, drunk or dead. At the very least ECMA-262 : Book Of Source is the must. So in your case: "[" is \u005B "]" is \u005D where both are in "Base Latin" Unicode table.
so
var foo\u005B\u005D = 'bar';
is the equivalent of foo[] = 'bar' *in the way you're looking for*.
if he's looking for a syntax error it is.
this\u005B"foo[]"\u005D = 'bar';
works better. but it's only another way of writing
this["foo[]"]='bar';
--
Bye.
Jasen
Jasen Betts wrote: On 2005-12-29, VK <sc**********@y ahoo.com> wrote:
<snip> var foo\u005B\u005D = 'bar';
is the equivalent of foo[] = 'bar' *in the way you're looking for*.
if he's looking for a syntax error it is.
this\u005B"foo[]"\u005D = 'bar';
works better.
<snip>
But it doesn't work at all well. ECMA 262 is unclear as to how that
should be handled, but the implication of what it does have to say about
UnicodeEscapeSe quences is that the above should be a syntax error, and
it is in IE and Opera. There is enough ambiguity in the specification to
allow Mozilla to treat the escape sequences as square brackets and so
operators but there are good reasons for expecting the syntax errors
reported by other browsers.
Javascript certainly cannot convert UnicodeEscapeSe quences in its source
code into their corresponding CVs prior to tokenisation without
violating the specification with regard to end-of-line comments, regular
expression and string literals (i.e. for example, /u000A may not be
treated as a LineTerminator (ECMA 262, 3rd edition; Section 7.3) in an
end-of-line comment or a regular expression or string literal).
Richard.
Richard Cornford wrote: Jasen Betts wrote: On 2005-12-29, VK <sc**********@y ahoo.com> wrote: var foo\u005B\u005D = 'bar';
is the equivalent of foo[] = 'bar' *in the way you're looking for*. if he's looking for a syntax error it is.
this\u005B"foo[]"\u005D = 'bar';
works better.
But it doesn't work at all well. ECMA 262 is unclear as to how that should be handled,
IBTD, I think it is pretty clear about that.
but the implication of what it does have to say about UnicodeEscapeSe quences is that the above should be a syntax error,
True. The implication of
| Unicode escape sequences are [...] permitted in identifiers, where they
^^^^^^^^^^^^^^
| contribute a single character to the identifier, as computed by the CV
^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^
| of the UnicodeEscapeSe quence (see section 7.8.4). The \ preceding the
| UnicodeEscapeSe quence does not contribute a character to the identifier.
is that the above should be equivalent to
this["foo[]"] = 'bar';
where the left hand side of the AssignmentExpre ssion should be parsed as
_one identifier_, at least the leading `this[' and the trailing `]' as
two identifiers, _not_ the property accessor syntax:
The \UnicodeEscapeS equence is allowed only in Identifiers and StringLiterals
(the Unicode escape sequence in RegularExpressi onLiterals is produced by
`\NonTerminator ', not `\UnicodeEscape Sequence'); since this is obviously
no string literal, it must be an identifier.
But `[' and `]' are not allowed in Identifiers, not even per evaluated
\UnicodeEscapeS equence --
| A UnicodeEscapeSe quence cannot be used to put a character into an
| identifier that would otherwise be illegal.
-- (or at least `Identifier StringLiteral Identifier = StringLiteral;'
cannot be produced by AssignmentExpre ssion), so theoretically this is a
SyntaxError anyway.
However, ECMAScript allows a conforming implementation "to support program
[...] syntax not described in this specification." ISTM that this
provision resets all arguments about how a conforming implementation MUST
be, as argued here, to how it CAN be, perhaps SHOULD be.
and it is in IE and Opera. There is enough ambiguity in the specification to allow Mozilla to treat the escape sequences as square brackets and so operators but there are good reasons for expecting the syntax errors reported by other browsers.
Yes, but I do not credit that to the specification's ambiguity.
Javascript certainly cannot convert UnicodeEscapeSe quences in its source code into their corresponding CVs prior to tokenisation without violating the specification with regard to end-of-line comments, regular expression and string literals
Yes it can :)
(i.e. for example, /u000A may not be
\u000A
treated as a LineTerminator (ECMA 262, 3rd edition; Section 7.3) in an end-of-line comment or a regular expression or string literal).
True, there are limitations set by ECMAScript where \UnicodeEscapeS equence
may be used. However, by the Conformance section (e.g. ES3, section 2), a
conforming implementation is allowed to support even that. See above.
So the bottom line is instead that there is an ECMAScript implementation
that supports the suggested syntax for creating property access syntax:
JavaScript. However, as we know that there are also widely distributed
ECMAScript implementations that do not support it (JScript, the Opera
implementation) , it is unwise to make use of it.
PointedEars
VK wrote: Any JavaScript literal can be represented upon ECMA-262 chapters which you should be able to spell alive, drunk or dead. At the very least ECMA-262 : Book Of Source is the must. So in your case: "[" is \u005B "]" is \u005D where both are in "Base Latin" Unicode table.
so
var foo\u005B\u005D = 'bar';
is the equivalent of foo[] = 'bar' *in the way you're looking for*.
While writing that I was PUI (Programming Under Influence). Please take
it into consideration while commenting and penalising.
I guess to be a bs that an illegal literal would become legal just
because of being Unicode-encoded. From the other side a code string
foo[] = something; is not an illegal literal per se (as such) but only
within the applied execution context therefore this problem could be
solved on the execution level => so it can be solved.
Hic! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Daniel |
last post by:
Hello =)
I have an object which contains a method that should execute every x ms. I
can use setInterval inside the object construct like this -
self.setInterval('ObjectName.methodName()', this.pinginterval);
- but is there no way to do this without using the literal ObjectName? If I
write 'this.methodName()' I get "Line 1 Char 1: Object doesn't support this
property or method." in IE, and nothing happens in Firebird.
|
by: lawrence |
last post by:
Sorry for the dumb question but I'm new to Javascript. I wrote this
script hoping to animate some div blocks on a page. You can see the
page here: http://www.keymedia.biz/demo.htm
Can anyone tell me why these DIVs don't drift to the left as they are
supposed to?
<script language="javascript">
|
by: ambika |
last post by:
Hello,
Am not very good with pointers in C,but I have a small doubt about
the way these pointers work..
We all know that in an array say x,x is gonna point to the first
element in that array(i.e)it will have the address of the first
element.In the the program below am not able to increment the value
stored in x,which is the address of the first element.Why am I not
able to do that?Afterall 1 is also a hexadecimal number then...
|
by: techno |
last post by:
Dear all,
Our bitmap has some x00 values ( '\0' ) and i am storing it in char*
array. the problem is that the '\0' is treated as eos character in c
and it is truncating it so the characters after it are not pass to the
function.
here is the code snippet
/*
DATA8583.data = ( char ) ( unsigned int ) 0xF0;
|
by: Jim Carlock |
last post by:
I have over a hundred pictures I would like to present.
Is it practical to create and parse an array of pictures,
picture paths, et al using server-side scripting to
accomplish this?
I created an array already, and whereby, the HTML and Javascript
currently used amount to about 14KB for each of four different
pages, the PHP page I started working on is already over 35KB in
size (most of it is server side processing creating the array...
| |
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - How do I access a property of an object using a string?
-----------------------------------------------------------------------
There are two equivalent ways to access properties: the dot
notation and the square bracket notation. What you are looking
for is the square bracket notation in which the dot, and the
identifier to its right, are replaced with a...
|
by: chopin |
last post by:
I am working in Access 2003 in Windows XP. I am using Visual Basic for Applications, using DAO to write my modules. What I need to do is write a module that will compare each row to see if they are equal to each other or not. Basically, equal numbers in succession indicate a "music chord" which is why I need to do this. For example, if the table is like so:
Notes.........Chord
A.....................111
B.....................111...
|
by: hlg |
last post by:
I have a question, which must surely have occurred to many programmers
since STL first appeared, and yet I have found no reference to it
anywhere, suggesting the problem is insoluble. Nevertheless, here it is:
I wish to create an two-dimensional array of objects. On the one hand,
it is useful to use STL containers for the rows and columns of the
array. On the other, it would be nice to address the elements by the
array element operator ...
|
by: case.learning |
last post by:
Hi everyone,
I'm doing a C problem checking for rudimentary syntax errors like
unbalanced parentheses, brackets, and braces. I only know parentheses
() or braces {}, but do not know what brackets are for in a C
program.
Could you shed some light for me?
Thanks.
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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...
|
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,...
|
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...
|
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |