CodeCharge Studio
search Register Login  

Visual PHP Web Development

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

YesSoftware Forums -> Archive -> GotoCode Archive

 Need a continue page

Print topic Send  topic

Author Message
Doug
Posted: 04/30/2003, 12:16 AM

I have a registration form adding a record in SQL. I want a continue button to show an Agreement page. If the person, presses "I agree" then I want the date to be added to my database.
Using ASP with CCS.

I am having trouble getting to this work.
Thanks,
Doug
Hamilton
Posted: 04/30/2003, 9:56 AM

METHOD 1

Two pages
Agree.asp
Registration.asp

For Registration.asp:
At the page level select the After_Initialize event and 'add code'
Place code something like this;
'// If the querystring doesn't have '?agreement=Yes'
'// Kick the user back to the agree.asp page.
'// Essentially forcing the user to agree in order to register
Dim vResult : vResult = Request.Querystring("agreement")
If Len(vResult) = 0 OR UCase(vResult) <> "YES" Then
Response.Redirect "agree.asp"
End If

'// if it didn't redirect, then
'// add the date to the date_agreed field
Dim vDate : vDate = FormatDateTime(Now(), vbShortDate)
formname.date_agreed.value = vDate

METHOD 2
agree.asp
Add a record (use the wizard is easiest) to the agree form.
Add a hidden field and bind it to the 'date_agreed' field... or whatever it's called.
Select the hidden field and on the Before_Show event - 'add code' or 'add action' [whichever you prefer] and set the hidden field to todays date.

Synapsis
By informing the user of the 'Terms of Agreement' before they can register solves issues not only from a database standpoint, but depending on various factors - the ability to legally enforce an agreement - imposed - 'after the fact' so to speak. So, the Terms of Agreement should be up front prior to the user being able to register. Thus, all registered users, by virtue of that registration (using method 1 above) have agreed to the terms - else the Registration.asp page would continue to redirect them back to the terms.
Hamilton
Posted: 04/30/2003, 10:10 AM

agree.asp

Form contains Terms of Use and a submit(OK) button
<INPUT TYPE="button" style="WIDTH: 150px; HEIGHT: 22px" CLASS="BlueNoteButton" VALUE="OK" name="btnAgree" class="BlueNoteButton" onClick="window.location='Registration.asp?agreement=YES'" onMouseOver="window.status=''; return true" onMouseOut="window.status=''; return true">

and the form contains a cancel button.
<INPUT TYPE="button" style="WIDTH: 150px; HEIGHT: 22px" CLASS="BlueNoteButton" VALUE="OK" name="btnCancelAgree" class="BlueNoteButton" onClick="window.location='home.asp'" onMouseOver="window.status=''; return true" onMouseOut="window.status=''; return true">
Doug
Posted: 04/30/2003, 12:33 PM

Hamilton,

Thank you! This will work good for me.

One question.
'// if it didn't redirect, then
'// add the date to the date_agreed field
Dim vDate : vDate = FormatDateTime(Now(), vbShortDate)
formname.date_agreed.value = vDate

Where do I get the formname? I have tried what I think is obvious, but run into a variable undefined error.

Doug
Hamilton
Posted: 04/30/2003, 1:50 PM

When you create the function, say
Function QuestionsToModerator_date_added_BeforeShow()

End Function

The formname in this case is: QuestionsToModerator
eg. QuestionsToModerator.date_added.value
Doug
Posted: 04/30/2003, 2:05 PM

Ok. I think I am a bit dense here. But here is my code in the Custom Events.

Function Page_AfterInitialize() 'Page_AfterInitialize @1-1E3DE16C

'Custom Code @142-73254650
' -------------------------
Dim vResult : vResult = Request.Querystring("agreement")
If Len(vResult) = 0 OR UCase(vResult) <> "YES" Then
Response.Redirect "NDAgreement.asp"
End If

Dim vDate : vDate = FormatDateTime(Now(), vbShortDate)
formname.ndasigned.value = vDate
' -------------------------

I am still at a loss as to what my form name will be. Thank you for your patience.
Doug
Hamilton
Posted: 04/30/2003, 3:09 PM

I see.
I may have misguided you with the formname part - now that I see the code.
In this case the code is being fired from the 'PAGE after initialize' event and so the reference to the field on the form - is invalid here... I think it hasn't been created yet at this point.
But the first part is correct, as soon as the page begins to load it 'checks and redirects' as necessary. I've placed the corrected code below.

Next in the before show event of the ndasigned assigned field add this;

Dim vDate : vDate = FormatDateTime(Now(), vbShortDate)
formname.ndasigned.value = vDate

I'm assuming this page has a record placed on it and the ndasigned field is bound to a data field in a table within the database.

When you 'add code' and create the Before_Show() event for ndasigned

It will look something like this
Function formname_ndasigned_Before_Show()
End Function

Actually it was wrong of me to call it form name and also, in hind-sight misleading. My apologies.
It probably would have been more correct of me to call it: RecordName
Thus it becomes...
Function RecordName_ndasigned_Before_Show()
Dim vDate : vDate = FormatDateTime(Now(), vbShortDate)
RecordName.ndasigned.value = vDate
End Function

Function Page_AfterInitialize() 'Page_AfterInitialize @1-1E3DE16C

'Custom Code @142-73254650
' -------------------------
Dim vResult : vResult = Request.Querystring("agreement")
If Len(vResult) = 0 OR UCase(vResult) <> "YES" Then
Response.Redirect "NDAgreement.asp"
End If
' -------------------------

   


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

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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