CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Check Field Change

Print topic Send  topic

Author Message
Andrew
Posted: 04/12/2004, 2:25 PM

I want to send an email to someone if a particular field in a record form is changed and updated

At the top of the asp page I:

Dim OldStatID

in the before show record event I:

OldStatID=Projects.StatusID.Value (control in record)

In the before Update I:

If OldStatID <> Projects.StatusID.Value then (send email)

the problem is that if I load a record, do not change it, and update (without changing a thing) it sends the email.

Projects.StatusID is an integer ....could it be a datatype issue? Please help!


peterr


Posts: 5971
Posted: 04/12/2004, 2:42 PM

I believe that the problem happens because the value of the OldStatID is set in one program execution, but read during another.
The scripts/programs work in the way that they are first run in the "show" mode, which displays the content of the Web page. Then when the users submit the form the script/program is "freshly" executed second time to process all submitted values. This could be compared to two programs in one script because one part of the program is used to display the data from the database, and another to process the submitted data. This would be OK, but the program must be executed twice, each time to perform different task, either to display/output the data or to process the input data. You are setting the value of OldStatID when the program display the data, but then this value is cleared/erased when the program is run again to process the user's input.
You may need to convert OldStatID to a session variable so that its value can be accessed acrosss multiple programs (in this case it's the same program but run at two different times).

However, you could also create a hidden field on your form and set its value in your Before Show event. Then it will be submitted automatically together with the regular data and you can read its value in the update events. This is similar to the session approach above but would save you little memory on the server. It is best to keep the use of sessions to minimum.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Andrew
Posted: 04/12/2004, 7:24 PM

8-) Thanks Peter. The Session worked. I will try hidden next. Thank you for such a quick reply

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.