struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Monkeyden <monkey...@gmail.com>
Subject Re: two form one jsp
Date Tue, 01 Aug 2006 20:49:59 GMT
Can we please stop suggesting use of the form name?  It.will.not.work.  If
both forms have the same name, it makes a reference to document.forms['foo']
an array and not a reference to the form.  Of course you *could *do this:

<html>
<head>
</head>
<script language="JavaScript" type="text/javascript">
function tellMe(){
    alert("Form 1: " + *document.forms['foo'][0].form2Text.value*);
    alert("Form 2: " + *document.forms['foo'][1].form2Text.value*);
}
</script>
<body>
<form action="foo" method="post" name="foo" id="foo">
    <input type="text" name="form2Text" value="This is 1">
</form>
<form action="bar" method="post" name="foo" id="bar">
    <input type="text" name="form2Text" value="This is 2">
</form>
<input type="button" name="myButton" value="Click It" onclick="tellMe();">
</body>
</html>

but A, that would be stupid, and B, you have to use the index value anyway.

On 8/1/06, kalpesh modi <modi_kalpesh@yahoo.com> wrote:
>
> I am not sure whether
>
> document. form['formName'] will work or not. Give it a try.
>
> -Kalpesh
>
>
>
> ---------------------------------
> Yahoo! Music Unlimited - Access over 1 million songs.Try it free.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message