hi,
i have a javascript method that looks at the value (author,title,isbn) that the user selects and if the isbn is null then it should open somefile.jsp and if not then open someother.jsp... here is the javascript:
<script language="javascript">
function checkSubmit(){
// Loop from zero to the one minus the number of radio button selections
for (counter=0; counter < submitform.authortitle.length; counter++){
if (submitform.authortitle[counter].checked){
String[] splitStr = authortitle[counter].split(","); //split at comma
if(splitStr[2].equals("null")){
//replace the form action with somefile.jsp
//submitform.action="searchAmazon.jsp";
document.forms[0].action="searchAmazon.jsp";
}else{
//submitform.action="isbnSearch.jsp";
document.forms[0].action="isbnSearch.jsp";
}
}
}
}
</script>
//here is the form:
<form action ="" method="get" name="submitform" onsubmit="return checkSubmit()">
<p>
<%
for(int i=1;i<=authorVector.size();i++){
%>
<input type="radio" name="authortitle" value="<%=titleVector.elementAt(i-1)%>,
<%=authorVector.elementAt(i - 1)%>, <%=isbnVector.elementAt(i - 1)%>">
<%=titleVector.elementAt(i - 1)%>, <%=authorVector.elementAt(i - 1)%>,
<%=isbnVector.elementAt(i - 1)%>
<br />
<%
}
%>
<br /><br />
Please select value to search for?
<input type="submit" value="Search">
</p>
</form>
BUT IT DOES NOT WORK PLS CAN SOMEONE HELP?
basically i want to check if isbn is present then i should use isbn to search but if it is null then it should just use author and title.
I tried doing it with 2 forms but there was a problem with the for loop and the submit button used to appear for each result...