>I have an ASP page, part of a corporate Intranet application that was just begun, using IE5 only as a browser. What I would like to do is Disable/Enable the Page Next/Previous command Buttons depending upon which Page the user is on. I have Next and Previous Procedures that are functional (toggle the page and do not crash and burn), using VBScript. Here is the basic concept of what I have done.
>
>Due to formating requirements of this web site, html brackets, double quotes, etc. are not included.
>
>html
>head
>META NAME=GENERATOR Content=Microsoft Visual Studio 6.0
>
>Language=VBScript
>
>form id=frmQPR name=frmQPR
>
>script Language=vbScript
>‘ Define variable…
>dim gForm
>
>Sub Window_OnLoad()
> set gForm = document.forms(frmQPR)
>‘ Place code here to evaluate status of Previous/Next page command
>‘ Buttons, based on Page being displayed…
>End Sub
>/script
>
>body
>HTML and ASP code goes here
>
>script Language=vbScript
>
>Sub Next_Page()
> ‘ Code to Evaluate cmdNext for page…
>gForm.cmdNext.disabled = true
>
>End Sub
>
>/script
>
>/BODY
>/head
>/HTML
>
>When the code hits gForm.cmdNext.disabled = true, I get an Error – Object doesn’t support this property or method ‘gForm.cmdNext’. Am I on the right track or not?
>
>The above code is not the prototype – just ment to focus on the approach so others can more easily understand the direction I am attempting. Can an object be defined and address in this manner? VFP is so much easier. Any ideas or approaches to this question will be appreciated.
>
>Tom
It is much easier and wiser to do this on the client side using JavaScript.
In you html, give the field and ID also. Then use JavaScript to reference the element. It would be even cooler to make it invisible like this:
document.all.id_cmdNext.style.visiblity = "hidden";
This will make the button invisible and is better than disabling it - only show the user what they can actually do!