-
1. Re: Need to update a record on page load. How?
Sudarshan Thiagarajan Sep 14, 2012 1:27 AM (in response to Steve Skinner)Pretty simple.
Create a form that is hidden with no submit button.
Add this code to your page:
onload="document.Formname.submit();"
Change Formname to whatever name you've set for your form.
Make the form submit action update the record of 'viewed' field to auto-increment.
Trust this helps!
-
2. Re: Need to update a record on page load. How?
Steve Skinner Sep 14, 2012 1:09 PM (in response to Sudarshan Thiagarajan)Hi Sudarshan,
I appreciate your reponse, but that doesn't solve my problem. The field I need to populate is not an auto-increment field. It's a specific value. I did try your method though but it did not work.
When the detail page loads, a specific field in a table for the record ID being viewed needs to updated with a value, which is basically used to mark the record as being viewed by the user.
-
3. Re: Need to update a record on page load. How? (ASP/VBScript)
bregent Sep 14, 2012 2:13 PM (in response to Steve Skinner)>Using the value from the ID in the URL querystring,
>update the "viewed" field in a specific table with the value of "y".
Be careful - depending on what you are doing, it's usually not safe to to an update based on a querystring value - it's too easy for someone to mess with these. Sudarshan's solution for posting the form to DW server behavior is good, but I wouldn't even use a form for this. Tell us more about the nature of the data and we can provide a solution.
-
4. Re: Need to update a record on page load. How? (ASP/VBScript)
Steve Skinner Sep 14, 2012 2:32 PM (in response to bregent)Good point! I wasn't thinking about how that would make the app vulnerable to sql injection.
The function I want to perform is similar to how an email changes from unread to read when you view it. I simple want the records being viewed to take on the status of being read or "viewed". Perhaps I'm going about this in the wrong way, but I've been planning to use a database field as the indicator of whether a record has a viewed status or not. Null value is new, and a value of "y" (yes) meaning the value is viewed/read.
If you have a better recommendation, I'm all ears.


