Hello,
I am experience some problems reading a form variable from a
Javascript function. The point with this particular variable is that
its name has the following syntax:
<input name="tx_impexp[tt_content:159]"/>
I want to set this var to 1 from my javascript function, so I tried
to execute the following line of code:
document.frm_1. tx_impexp[exclude][tt_content:159].value=1;
Unfortunately the following error come up:
Error: missing ] in index expression
document.frm_1. tx_impexp[exclude][tt_content:159].value=1
--------------------------------------------------------------|
It seems Javascript expects to close down the bracket at the position
marked...An easy solution would be to change my var syntax but the
point is that I cannot since I am using an already made script and I
should not modify it.
Just wandering if this is due to a syntax error defined according to
Javascript specification language or there is something wrong with
this. Maybe there is a work-around to get this done. Any help would be
highly appreciated.
Thank you very much!
Diego Pino 5 2093
On Mar 26, 2:20 pm, "Diego Pino" <pinow...@gmail .comwrote:
Hello,
I am experience some problems reading a form variable from a
Javascript function. The point with this particular variable is that
its name has the following syntax:
<input name="tx_impexp[tt_content:159]"/>
I want to set this var to 1 from my javascript function, so I tried
to execute the following line of code:
document.frm_1. tx_impexp[exclude][tt_content:159].value=1;
Unfortunately the following error come up:
Error: missing ] in index expression
document.frm_1. tx_impexp[exclude][tt_content:159].value=1
--------------------------------------------------------------|
It seems Javascript expects to close down the bracket at the position
marked...An easy solution would be to change my var syntax but the
point is that I cannot since I am using an already made script and I
should not modify it.
Just wandering if this is due to a syntax error defined according to
Javascript specification language or there is something wrong with
this. Maybe there is a work-around to get this done. Any help would be
highly appreciated.
Thank you very much!
Diego Pino
You can use document.getEle mentByName('tx_ impexp[tt_content:159]')
[0].value = 1; (or maybe for your example use
document.getEle mentByName('tx_ impexp[tt_content:159]')[exclude].value
= 1;
OR
You can provide an id attribute and find it using that (i.e. using
getElementById( 'value')) without interfering with the name attribute.
On Mar 27, 5:20 am, "Diego Pino" <pinow...@gmail .comwrote:
Hello,
I am experience some problems reading a form variable from a
Javascript function. The point with this particular variable is that
its name has the following syntax:
<input name="tx_impexp[tt_content:159]"/>
I want to set this var to 1 from my javascript function
The group FAQ is a great resource:
"4.25 My element is named myselect[] , how do I access it?"
<URL: http://www.jibbering.com/faq/#FAQ4_25 >
--
Rob
>
You can use document.getEle mentByName('tx_ impexp[tt_content:159]')
[0].value = 1; (or maybe for your example use
document.getEle mentByName('tx_ impexp[tt_content:159]')[exclude].value
= 1;
Sorry, document.getEle mentsByName('tx _impexp[exclude][tt_content:
159']).value it seems to work, at least no error is raised, but what
is actually happening is that getElementsByNa me is returning an
undefined value.
>
OR
You can provide an id attribute and find it using that (i.e. using
getElementById( 'value')) without interfering with the name attribute.
Nice work-around!!! I did it and well, it worked!
Thanks Tom!
On Mar 27, 6:44 am, "Diego Pino" <pinow...@gmail .comwrote:
You can use document.getEle mentByName('tx_ impexp[tt_content:159]')
[0].value = 1; (or maybe for your example use
document.getEle mentByName('tx_ impexp[tt_content:159]')[exclude].value
= 1;
Sorry, document.getEle mentsByName('tx _impexp[exclude][tt_content:
159']).value it seems to work, at least no error is raised, but what
is actually happening is that getElementsByNa me is returning an
undefined value.
No, it doesn't. It returns a (possibly empty) collection.
<URL: http://www.w3.org/TR/DOM-Level-2-HTM...ml#ID-71555259 >
--
Rob
Tom Cole said the following on 3/26/2007 3:46 PM:
On Mar 26, 2:20 pm, "Diego Pino" <pinow...@gmail .comwrote:
>Hello,
I am experience some problems reading a form variable from a Javascript function. The point with this particular variable is that its name has the following syntax:
<input name="tx_impexp[tt_content:159]"/>
I want to set this var to 1 from my javascript function, so I tried to execute the following line of code:
document.frm_1 .tx_impexp[exclude][tt_content:159].value=1;
Unfortunatel y the following error come up:
Error: missing ] in index expression document.frm_1 .tx_impexp[exclude][tt_content:159].value=1 --------------------------------------------------------------|
It seems Javascript expects to close down the bracket at the position marked...An easy solution would be to change my var syntax but the point is that I cannot since I am using an already made script and I should not modify it.
Just wandering if this is due to a syntax error defined according to Javascript specification language or there is something wrong with this. Maybe there is a work-around to get this done. Any help would be highly appreciated.
Thank you very much!
Diego Pino
You can use document.getEle mentByName('tx_ impexp[tt_content:159]')
[0].value = 1; (or maybe for your example use
document.getEle mentByName('tx_ impexp[tt_content:159]')[exclude].value
= 1;
OR
You can provide an id attribute and find it using that (i.e. using
getElementById( 'value')) without interfering with the name attribute.
OR
You can use a reliable cross browser method that is mentioned in the FAQ
to answer this specific type question. Bracket Notation is your friend
when dealing with form elements.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: flipflop |
last post by:
I need to create a global array whose dimensions depend on the
contents of another global array populated at its initialisation. For
example:
int array1={3,2,1};
int array2]; //should be equiv. to: int array2;
GCC gives these errors:
variable-size type declared outside of any function
variable-sized object may not be initialized
|
by: Edd |
last post by:
Hello all,
I've made a data structure and an associated set of functions to enable me
to store a dynamically-sized array of elements of whatever data type I like.
Well that's the idea anyway...
My implementation seems to work great for primitive types, structures and
unions, but I can't quite get an array of function-pointers working
properly. Here's a very reduced version of my code with error checks removed
for the sake of brevity.
|
by: Nico Gerber |
last post by:
I have an already developed C# application, that needs to pass a pointer to
an array of bytes (of size 50), to another already developed C++ application
hosted in a DLL. My array of bytes are hosted in an unsafe static class to
force the C# garbage collector not to move it around, as the C++ application
will be responsible to update the array during runtime. My structure is
defined as follows:
public struct DATA
{
|
by: 2obvious |
last post by:
I have a DataGrid containing a TextBox control and a CustomValidator
in each row.
The CustomValidator fires a function that compares all TextBoxes for
equality. The
algorithm for comparison is straightforward:
*PSEUDOCODE*
|
by: Roman Mashak |
last post by:
Hello,
I encountered a piece of code, which I can't entirely understand. Here it
is:
#define TX_BUF_SIZE 1024
struct priv {
...
unsigned char *tx_buf;
unsigned char *tx_bufs;
| |
by: DoomedLung |
last post by:
Hey everyone,
I'm currently reading Sitepoint's 'Javascript Anthology' and keep
spotting a reference I'm not quite familiar with, such as
'document.getElementByTagName('p')'. What I want to know is if this
reference points to the first element with the containing object?
Cheers
|
by: Buglish |
last post by:
Hi,
Task :
-Capture a HTML table with use of regular expression from a text string buffer(entire document).
–Pass it to another function to create a multi dimension array out of it.
- Pass it to another function to build it into a RTF table.
-Then return it back to the regular expression to replace the search result.
Difficulty:
-The regular expression doesn’t pass the back referenced table fields to the next function.
|
by: HockeyFan |
last post by:
Yesterday, I posted a question dealing with an issue of trying to
reference (from javascript on the client side) an item within a
Repeater. My code was hard-coded to use the actual ClientId, but
someone admonished me, stating that I shouldn't do that because the id
could change. However, since I'm trying to reference a control on a
Repeater line, I'm wondering how else to do that. Repeaters aren't
rendered in html are they? What method...
|
by: Andrus |
last post by:
I need compile in-memory assembly which references to other in-memory
assembly.
Compiling second assembly fails with error
Line: 0 - Metadata file 'eed7li9m, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null' could not be found
Saving assembly to Windows temp directory for referencing only creates huge
amout of temporary
|
by: wangers16 |
last post by:
Hi all,
I have the following array with which I need to reference to the second item in every array and write it out onto the page, how can this be done?
var arr = new Array();
arr = 'images/001.jpg','Image 1 Description SECOND ITEM';
arr = 'images/002.jpg','Image 2 Description SECOND ITEM';
|
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: 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,...
|
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: 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: 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: 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...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |