Hey fellas, I need some help doing on action changes
This is what I got. I have a loop that has the form name "autoEmailRedirect"
<form name="autoEmailRedirect" method="post" action="autoEmailContact.jsp">
<td valign="top" class="paddingLeft10 paddingTop9">
<div class="paddingBottom2 boldFont paddingTop20"><%=(String)autoName.elementAt(i)%></div>
</td>
<td class="paddingTop9 paddingLeft" valign="top">
<div class="paddingBottom2 paddingTop20"><%=(String)autoEmail.elementAt(i)%></div>
</td>
<td class="paddingLeft11 paddingTop9 paddingBottom13 width66" valign="top">
<select name="actionChoice" size="1">
<option value="1">Get Details about this customer</option>
<option value="2">E-mail Username/Password to customer</option>
<option value="3">E-mail link to Login page to customer</option>
<option value="4">Un-subscribe this customer</option>
</select>
<input type="submit" name="method" value="Go" onClick="javascript:doCustomRedirect();" class="butn smallbutn3 last">
<input type="hidden" name="email" value="<%=(String)autoEmail.elementAt(i)%>"/>
<INPUT TYPE="hidden" NAME="username" VALUE="<%=username%>"/>
<INPUT TYPE="hidden" NAME="password" VALUE="<%=password%>"/>
</td>
</form>
So if it has 3 instances...it prints out 3 times.
Now the javascript I have is
function doCustomRedirect()
{
var frm = document.forms["autoEmailRedirect"];
if(frm.actionChoice.value == "1")
{
document.forms["autoEmailRedirect"].action = 'http://<%=javaAdminServer%>/JAABA/jsp/cpanel/autoEmailContact.jsp';
document.forms["autoEmailRedirect"].submit();
}
if (frm.actionChoice.value == "2")
{
document.forms["autoEmailRedirect"].action = 'http://<%=javaAdminServer%>/JAABA/jsp/cpanel/cp-ecomm.jsp';
document.forms["autoEmailRedirect"].submit();
}
if (frm.actionChoice.value == "3")
{
document.forms["autoEmailRedirect"].action = 'http://<%=javaAdminServer%>/JAABA/jsp/cpanel/changeAccount.jsp';
document.forms["autoEmailRedirect"].submit();
}
if (frm.actionChoice.value == "4")
{
document.forms["autoEmailRedirect"].action = 'http://<%=javaAdminServer%>/JAABA/jsp/cpanel/autoContactDelete.jsp';
document.forms["autoEmailRedirect"].submit();
}
}
This doesnt seem to be working at all..it goes to the page "autoEmailContact.jsp". no matter what option I choose
now If I do " document.forms[0].action"
I can get the 1st form to work...but the other 2 dont work
..and Im guessing because all the forms have the same name and it doesnt know which one to access????
Help a brotha out
thanx