If you have two forms with the same name (e.g. 'myFormName'), you can access them like this:

document.myFormName[0]
document.myFormName[1]

I had this problem today myself :o)

HTH,
Colin

Yann Lebreton wrote:

You need to trace your javascript: make sure it runs, make sure it gets the data...

FYI if you have 2 forms with the same name or in your form 2 fields named ids (or modify) this script won't work.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 11:49 AM
To: Struts Users Mailing List
Subject: RE: How to identify submit button in JSP


Well, I have a couple of other forms with the same
form  name 'idForm' but diffrent action, does that
cause the problem? How should I handle that?

I checked the form name in html output, it is right. I
didn't get any javascript error.


Thanks.

--- Yann Lebreton <[EMAIL PROTECTED]> wrote:


Do you have other forms in the page? In the html output did you check the form name?

Do you get a javascript error ?

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 9:41 AM
To: Struts Users Mailing List
Subject: RE: How to identify submit button in JSP


That's what I did. But the 'modify' button didn't
react at all.
--- Yann Lebreton <[EMAIL PROTECTED]> wrote:


Try:
        function Disable() {
                frm=document.forms['form1']
                if(frm.ids.checked)
                {frm.modify.disabled=false}
                else {frm.modify.disabled=true}
        }

Or simpler:
        function Disable() {
                frm=document.form1;
                frm.modify.disabled = !( frm.ids.checked );
        }


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 8:30 AM
To: [EMAIL PROTECTED]
Subject: How to identify submit button in JSP


Hi,

I am new to struts, now I have trouble figuring


this


out. I do need to have this done, please help!

My problem is the submit button didn't react to
changes on checkbox, is that because I didn't
identify
the button correctly or anything else I did wrong?
My
jsp code is like the following: (if I add
'disabled="true"' in submit, the button will


always


be
disabled).


<SCRIPT LANGUAGE="JavaScript">
function Disable() {
frm=document.forms[form1]
if(frm.ids.checked)
{frm.modify.disabled=false}
else {frm.modify.disabled=true}
}
</SCRIPT>


<html:form action="/Myaction"
name="form1"
type="MyformType">


<input type="submit" name="add" value="Add"/>
<input type="submit" name="modify"


value="Modify"/>


<input type="submit" name="delete"


value="Delete"/>


<%
while (iterator.hasNext()) {
String v1=...;
%>
<input type="checkbox" name="ids" value="v1"


onClick="Disable();"/>something
<%
  }
%>

What I eventually want to do is to disable this
'modify' button when no checkbox or more than one
are
selected. In other word, only enable it when only
one
checkbox is selected, this is just the first step,
but
it's not working.

Thanks in advance!

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail


AddressGuard


http://antispam.yahoo.com/whatsnewfree




---------------------------------------------------------------------


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





---------------------------------------------------------------------


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



__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree




---------------------------------------------------------------------


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





---------------------------------------------------------------------


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





__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

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


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







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



Reply via email to