Have you tried:

onclick="alert(document.testForm.elements['att[0]'].value)"

?


-----Original Message-----
From: Fabiano de O. Lucchese [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 25, 2003 1:53 PM
To: [EMAIL PROTECTED]
Subject: Indexed properties and JavaScript


Hi All,

I've been trying to develop a Struts based web site
and got stuck by the following problem: I have defined
a form bean that contains indexed properties; thus,
I'm supposed to use squared brackets "[x]" to refer to
the individual elements of each of these "array-like
properties" into my HTML/JSP page; on the other hand,
I also had to embbed some javascript code in this page
in order to enlighten the server-side processing. The
problem is that I just can't use javascript code along
with "array-like properties" because the brackets used
by them seem to conflict with the javascript syntax.

The following sample code reproduces this problem:

<html>
        <head>
                <title>test</title>
        </head>

        <body>
                <form action="/test" method="GET"
name="testForm">
                        <input type="text"
name="att[0]">
                        <input type="button"
onclick="alert(document.testForm.att[0])"
value="test">
                </form>
        </body>
</html>

and the error message is something like:
"document.testForm.att.0 is null or is not an object".

One should notice that when the index reference [0] is
deleted, the page works fine.

Does anyone here has any experience with this problem
?

Thanks in advance.

FLu-X


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Confidentiality Warning:  This e-mail contains information intended only for the use 
of the individual or entity named above.  If the reader of this e-mail is not the 
intended recipient or the employee or agent responsible for delivering it to the 
intended recipient, any dissemination, publication or copying of this e-mail is 
strictly prohibited. The sender does not accept any responsibility for any loss, 
disruption or damage to your data or computer system that may occur while using data 
contained in, or transmitted with, this e-mail.   If you have received this e-mail in 
error, please immediately notify us by return e-mail.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to