This topic is locked

If No Record

2/20/2004 6:34:02 AM
ASPRunnerPro General questions
author

The first area on my edit form is a select box that has it's results filtered by the employee who is logged on. In the order versions if that employee had no values for the select box it was left off the page but now it is a textbox. Is there a way to read if that select box has no value and if so just produce a PopUp box that says 'see a manager' and never leave the list page?
Thanks,

Newbie but Improving

Sergey Kornilov admin 2/20/2004

Hi,
you can do something like this:

<%

Set rsTemp = server.CreateObject ("ADODB.Recordset")

set dbTemp = server.CreateObject ("ADODB.Connection")

dbTemp.ConnectionString = strConnection

dbTemp.Open

rsTemp.open "select count(*) from tablename where userid=" & Session("UserID"), dbTemp

if rsTemp.eof then

  %>

      <script>

          alert('Please see manager');

      </script>

  <%

end if

rsTemp.close : set rsTemp = nothing

dbTemp.close : set dbTemp = nothing
%>


I'm not sure where is the best place to put this. It depends on your application structure.

501011 2/23/2004

Admin,

Isn't there a way to have the select boxes NOT be there if there is no data? That is the way the older version was 2.2, 2.3. It's 2.4 that gives them a textbox instead of a select box if the select box is empty. This causes PROBLEMS. Because they eneter data in the box.
Thanks,

Newbie
PS I tried your code in several places and didn't get the results I wanted. It would be idea to have the user click on 'Add' if if the selectbox "WID" has no resilts then the Popup would appear and just redirect back to the list page. The textbox appearing seems to be a BUG to me.