Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with multiple search items returned

Status
Not open for further replies.

donniea21

MIS
Feb 16, 2001
75
US
I have a detail page that loops through and brings back search results

<%do While NOT ComplianceDetail.EOF%>
<form method=&quot;POST&quot; name=&quot;myform&quot; action=&quot;&quot;>
<input type=&quot;hidden&quot; name=&quot;rowNo&quot; value=&quot;<%=(ComplianceDetail.Fields.Item(&quot;ID&quot;).Value)%>&quot;>

<td width=&quot;79&quot; valign=&quot;middle&quot; height=&quot;1&quot;><%=(ComplianceDetail.Fields.Item(&quot;AreaofComp&quot;).Value)%></td>

<td width=&quot;220&quot; valign=&quot;middle&quot; height=&quot;1&quot;><%=(ComplianceDetail.Fields.Item(&quot;Requirement&quot;).Value)%></td>

etc...
<input type=&quot;submit&quot; value=&quot;Edit&quot; name=&quot;btEdit&quot; onclick=&quot;doSubmit()&quot;>

<input type=&quot;button&quot; value=&quot;View Workflow&quot; name=&quot;btWorkflow&quot; onClick=&quot;doSubmit()&quot;>
</form>
<%ComplianceDetail.MoveNext()
loop%>

as a javascript fucntion i have:
function doSubmit()
{
if(window.event.srcElement.name == &quot;btEdit&quot;)
{
document.myform.action=&quot;edit.asp&quot;;
}
else
{
document.myform.action=&quot;workflowdetail.asp&quot;;
}
document.forms[0].submit();
}

this works fine if my search brings back 1 result.if i bring >1 than the form submits to itself..
 
put your form tags on the outside of the loop, and see if that helps.

penny.gif
penny.gif
 
Just in case anyone has a similar probliem. it was a simple problem of reading the right form...so i added a counter variable and appended it to the form name (i.e myform1,myform2, etc)

<%i=0
do While NOT ComplianceDetail.EOF
i=i+1
%>
<form method=&quot;POST&quot; name=&quot;myform<%=i%>&quot; action=&quot;&quot;>
<%ComplianceDetail.MoveNext()
loop%>

i then set the two buttons to two different javascript functions and passed the &quot;i&quot; value

<input type=&quot;submit&quot; value=&quot;Edit&quot; name=&quot;btEdit&quot; onclick=&quot;doEdit(<%=i%>)&quot;>

<input type=&quot;submit&quot; value=&quot;View Workflow&quot; name=&quot;btWorkflow&quot; onClick=&quot;doFlow(<%=i%>)&quot;>



function doEdit(frmno)
{
var str1 = &quot;myform&quot;;
var str2 =frmno;
var frmname = str1.concat(str2);

document.forms[frmname].action = &quot;edit.asp&quot;;
document.forms[frmname].submit();
}

function doFlow(frmno)
{
var str1 = &quot;myform&quot;;
var str2 =frmno;
var frmname = str1.concat(str2);

document.forms[frmname].action=&quot;workflowdetail.asp&quot;;
document.forms[frmname].submit();
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top