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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Response write

Status
Not open for further replies.

danjapro

Programmer
Aug 27, 2004
54
US
I want response write after each select case but i keep gettin errors

CODE::::::::::::::::::::::
here is my code how would a I write the response write base on the case:

<%
Select Case f
Case "ane"
call ane

Case "dot"
call dot
Case "delete"
call del
Case "edt"
call edt
Case "unc"
call unc
Case "edit"
set objFileTextStream = objFileItem.OpenAsTextStream(1,-2)
lines = 0
Do While objFileTextStream.AtEndOfStream <> True
data(lines) = objFileTextStream.ReadLine
lines = lines + 1
Loop
%>

<form action="func.asp" method="get">
<input type="hidden" name="l" value="<%= l%>"><input type="hidden" name="f" value="edt"><p><strong><small><font
face="Verdana">Edit Entry:</font></small></strong></p>
<p><strong><small><font face="Verdana">Date:</font></small></strong><br>
<input type="text" name="d" size="20" value="<%= data(l+1)%>"> <br>
<strong><small><font face="Verdana">Entry:</font></small></strong><br>
<textarea name="e" rows="5" Cols="30"><%= data(l+2)%></textarea> <br>
<input type="submit" value="update"> </p>
</form>
<%

end select

%>

<p><strong><small><font face="Verdana"><a href="admin.asp">Back to Admin</a></font></small></strong></p>
</body>
</html>
 
<%
Select Case f
Case "ane"
call ane
response.write("whatever")
Case "dot"
call dot
response.write("whatever")
Case "delete"
call del
response.write("whatever")
Case "edt"
call edt
response.write("whatever")
Case "unc"
call unc
response.write("whatever")
Case "edit"
set objFileTextStream = objFileItem.OpenAsTextStream(1,-2)
lines = 0
Do While objFileTextStream.AtEndOfStream <> True
data(lines) = objFileTextStream.ReadLine
lines = lines + 1
Loop
%>

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
 
I did that man, but i want the response wite to appear after the

<%

end select

%>
statement based upoen what the select case is
 
In that case, just set a variable in the cases and then response.write the variable at the end.
Code:
<%
Dim strMyString

Select Case f
Case "ane"
    call ane
    strMyString = "Thing 1"
Case "dot"
    call dot
    strMyString = "Thing 2"
Case "delete"
    call del
    strMyString = "Thing 3"
Case "edt"
    call edt
    strMyString = "Thing 4"
Case "unc"
    call unc
    strMyString = "Thing 5"
Case "edit"
    set objFileTextStream = objFileItem.OpenAsTextStream(1,-2)
    lines = 0
    Do While objFileTextStream.AtEndOfStream <> True
        data(lines) = objFileTextStream.ReadLine
        lines = lines + 1
    Loop
    strMyString = "Thing 6"
%>

<form action="func.asp" method="get">
<input type="hidden" name="l" value="<%= l%>"><input type="hidden" name="f" value="edt"><p><strong><small><font
face="Verdana">Edit Entry:</font></small></strong></p>
<p><strong><small><font face="Verdana">Date:</font></small></strong><br>
<input type="text" name="d" size="20" value="<%= data(l+1)%>"> <br>
<strong><small><font face="Verdana">Entry:</font></small></strong><br>
<textarea name="e" rows="5" Cols="30"><%= data(l+2)%></textarea> <br>
<input type="submit" value="update"> </p>
</form>
<%
end select

Response.Write(strMyString)
%>
 
Err...first let me point out that outputting inside the Select Case and outputting right after it will be the same exact result as far as the client browser is concerned.

However, if it is your desire to have the output display after the Back To Admin paragraph you could simply move the Select Case to that section.

If you only need to output a simple string after the Back To Admin section but need to execute the given functions [and display their output] before it, you could simply set a variable in each case then Write it afterwards:
Code:
<%
[highlight]Dim fin_output[/highlight]
Select Case f
   Case "ane"
      call ane
      [highlight]fin_output = "ANE was called"[/highlight]
   Case "dot"
      call dot
      [highlight]fin_output = "DOT was called"[/highlight]
   Case "delete"
      call del
      [highlight]fin_output = "DEL was called"[/highlight]
   Case "edt"
      call edt
      [highlight]fin_output = "EDT was called"[/highlight]
   Case "unc"
      call unc
      [highlight]fin_output = "UNC was called"[/highlight]
   Case "edit"
      [highlight]fin_output = "EDIT was executed"[/highlight]
      set objFileTextStream = objFileItem.OpenAsTextStream(1,-2)
      lines = 0
      Do While objFileTextStream.AtEndOfStream <> True
         data(lines) = objFileTextStream.ReadLine
         lines = lines + 1
      Loop
      %>
      <form action="func.asp" method="get">
      <input type="hidden" name="l" value="<%= l%>"><input type="hidden" name="f" value="edt"><p><strong><small><font
face="Verdana">Edit Entry:</font></small></strong></p>
<p><strong><small><font face="Verdana">Date:</font></small></strong><br>
<input type="text" name="d" size="20" value="<%= data(l+1)%>"> <br>
<strong><small><font face="Verdana">Entry:</font></small></strong><br>
<textarea name="e" rows="5" Cols="30"><%= data(l+2)%></textarea> <br>
<input type="submit" value="update"> </p>
</form>
<%
[highlight]   Case Else   'Always include an else, even if it shouldn't be reachable
      Response.Write "An invalid response was received by the server, please return to the previous page and mak sure you filled out everything correctly."
      fin_output = "ELSE was reached: " & f & " was received"[/highlight]
end select

%>
<p><strong><small><font face="Verdana"><a href="admin.asp">Back to Admin</a></font></small></strong></p>
[highlight]Response.Write fin_output[/highlight]
</body>
</html>

Now it will still execute the given functions before the "Back to Admin" section but it will output a final message after that section dependant on the case that was executed.

-T

barcode_1.gif
 
Beat me to it Gen, thats what I get for going back to highlight everything [and provide indentation manually] :p

barcode_1.gif
 
Yours is much nicer, and makes the point about the results being the same. How do you do that hightlighting, it's a big improvement?
 
Here is some [highlight][ignore][highlight][/ignore][/highlight]highlighted text[highlight][ignore][/highlight][/ignore][/highlight]. Just put it in block highlight tags. You can also specify a color in the beginning tag if you want it to be something other then yellow,

-T

barcode_1.gif
 
Thanks so much

Tarwn (Programmer)

I think as long as I have been a memebr you have printed the best solutions.

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top