Spudhead
08-20-2002, 01:31 PM
I don't think my brain is working right today, this is fairly straightforward but I can't get my head round it.
In an array, I have a list of costcodes that the currently logged-in user is associated with: they can sign off any orders that have that costcode.
I'm looping through a recordset of orders. Inside that loop, I then loop through the array, looking for a match between that order's costcode and one of the user's costcodes. If I find a match, I want to write an "Authorise" button" - if not, I don't.
It's not working because it doesn't break out of the if statement correctly. I'm aware of labeling statements and breaking out of them like that, and I think that's what I need to do - but can't find much reference on it. I'm doing this in JSCRIPT, by the way.
Here's what I've got, if anyone can help with the logic or pointing out where I'm going wrong with the syntax, I'd be grateful.
Cheers.
<%
for(i=0;i<userCodes.length;i++){
Inner:if((String(userCodes[i]))==(String(rs.Fields("costcode")))){
%>
<td class="bodytext" valign="top"><input type="button" class="actionbutton" value="Authorise" onClick="authOrder('<%=rs.Fields("orderID")%>')"></td>
<%
break Inner;
}
else{
%>
<td class="bodytext" valign="top"> </td>
<%
break Inner;
}
}
%>
In an array, I have a list of costcodes that the currently logged-in user is associated with: they can sign off any orders that have that costcode.
I'm looping through a recordset of orders. Inside that loop, I then loop through the array, looking for a match between that order's costcode and one of the user's costcodes. If I find a match, I want to write an "Authorise" button" - if not, I don't.
It's not working because it doesn't break out of the if statement correctly. I'm aware of labeling statements and breaking out of them like that, and I think that's what I need to do - but can't find much reference on it. I'm doing this in JSCRIPT, by the way.
Here's what I've got, if anyone can help with the logic or pointing out where I'm going wrong with the syntax, I'd be grateful.
Cheers.
<%
for(i=0;i<userCodes.length;i++){
Inner:if((String(userCodes[i]))==(String(rs.Fields("costcode")))){
%>
<td class="bodytext" valign="top"><input type="button" class="actionbutton" value="Authorise" onClick="authOrder('<%=rs.Fields("orderID")%>')"></td>
<%
break Inner;
}
else{
%>
<td class="bodytext" valign="top"> </td>
<%
break Inner;
}
}
%>