This topic is locked

problem with before record update event

3/1/2007 9:39:01 PM
ASPRunnerPro General questions
W
waynes author

I have a problem similar to one I reported earlier (re: Header and master table locations.
This time it relates to the "before record updated" event. I add an error message that is displayed if some criteria is not met and the message is displayed before the pages is loaded, eg:

Error: Start date must be before End date<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">;

<HTML><HEAD><TITLE>Trip Dates</TITLE>


Ony seems to happen on the "before record updated" event (all options). All other events place the message correctly within the page in the message area.

J
Jane 3/2/2007

I see what you're saying. You can do the following:

  • save your message in the Session variable in the Before record updated event:

    Session("my_message") = "your message here"


  • and then print this variable in the EditOnLoad event:

    Response.Write session("my_message")



W
waynes author 3/2/2007

I see what you're saying. You can do the following:

  • save your message in the Session variable in the Before record updated event:
  • and then print this variable in the EditOnLoad event:


I would have prefered it to work as the other events do but I suppose this will do with one exception after the message has been written - the session needs to be cleared otherwise it will always be displayed.

C
clig 3/3/2007



I would have prefered it to work as the other events do but I suppose this will do with one exception after the message has been written - the session needs to be cleared otherwise it will always be displayed.


something like:
If blah blah then

Session.Abandon

Response.Clear

Response.Redirect "login.asp"

end if

J
Jane 3/5/2007

Yes, just use following code in the EditOnLoad event:

Response.Write Session("my_message")

Session("my_message")=""