Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting page variable and determing state

Status
Not open for further replies.

computergeek

Programmer
May 23, 2001
193
CA
Hello,

I am trying to determine what state my form is currently in. (Add or Update) Within my btnAdd_Clicked() script I set the variable (Addtrans = true), then within the btnSave_Clicked() script I check this variable to determine whether to do an update or an insert to the table. The Addtrans variable is declared outside the 2 server side scripts right after the script tag for the server side scripts. HOW DO YOU DECLARE A VARIABLE THAT CAN BE USED THROUGHOUT THE PAGE BY ALL SERVER-SIDE SCRIPTS? (Cannot use Page Object, see note below.)

<SCRIPT ID=serverEventHandlersVBS LANGUAGE=vbscript RUNAT=Server>
Dim Addtrans

I have attempted to use the Page Object DTC on this page with no success. The problem is that it seems to automatically name the object...then name shows as an invalid name with an exclaimation mark. (!Site) This page was created using the site.asp page, renamed, and changes made as required.

Thanks,

Computergeek
 
In all of my pages I do the following

<Html>
<Head>....</Head>
<Body>
<%
Dim msSql
msSql = &quot;Select * from Customer&quot;
%>
...
...
...

later on in script I access the value and use it
to retrieve data. With out issue.

you could also do the request(&quot;field&quot;) each time you
need it.



 
A value 'persists' through server round-trips if it is stored in a hidden form field. something like...

dim varMyVariable
varMyVariable = request(&quot;h_varMyVariable&quot;)
...
<input type=&quot;hidden&quot; name=&quot;h_varMyVariable&quot; value=&quot;<%=varMyVariable%>&quot;>

The pageObject DTC makes the creation of these hidden variables very easy. The pageObject NAME can be anything - so just type a different name - say &quot;page_Site&quot; or similar - to see if this corrects the problem. You must not have two pages with the same pageObject 'name' - one use of the PageObject is to assist in chaining pages together, and this goes wrong if there are duplicate names.

In your code, on any page, you refer to the pageObject as 'thisPage'. (Content Management)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top