Posted: 07/21/2006, 7:31 AM |
|
Hi there
I've searched the site up and down (I'm sure I have missed the resolution somewhere) the site and found plenty of information of page redirection but can't find what I'm looking for.
What I need to be able to do is from a list screen when the user selects a record to view, onclick the system checks to see if the logged in user (userid) is that records Saleperson. If they are then they get an updatable view (HBFF2A.asp) if they are not then the only get a read only view (HBFF2B.asp) along with the records ID (OID). I've tried the following code to Href Source of the link but it doesn't seem to work.
Java =
function ViewOpportunityFromList()
{
If (document.0pportunity.Salesperson.value ==(session("userid")))
e.getPage().setRedirectString("HBFF2A.asp");
Else
e.getPage().setRedirectString("HBFF2B.asp");
}
and
function ViewOpportunityFromList()
{
If (document.Opportunity.Salesperson.value ==(session("userid")))
window.location = "HBFF2A.asp";
Else
window.location = "HBFF2B.asp";
}
These both return the error "document.Opportunity.Salesperson is null or not an object". I think this may be to do with it been a list screen not a record screen?
Also when I try the following VBScript code
function ViewOpportunityFromList()
If Salesperson.value = (session("userid")) then
Redirect = "HBFF2A.asp"
else
Redirect = "HBFF2B.asp"
end if
end function
with the on click code being
VBScript:ViewOpportunityFromList(this.form.Salesperson.value)
I receive the following error message
"object required 'this'".
i'm currently developing in ASP with SQL2000
Any help on how I may achieve my requirement to load either the update form or view form based on the userid from a list screen would be much appreciated.
Many thanks in advance
Rob
|