Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Onclick Help

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,25311
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> Onclick Help
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Onclick Help - 8/27/2005 3:50:24 PM   
  thunderchild

 

Posts: 4
Score: 0
Joined: 8/16/2005
Status: offline
Hi all

Can anyone tell me what the VBscript syntax is for using the Onclick function. I have look around the internet and found several examples of other peoples work, but none of them are the same. or explain where to place the parts of code. I have tried to use the onclick with a page but i get an error of undefined function name(savedata)
My site is completely SSI using asp/vbscript , and i am also using dreamweaver mx which adds it's own long winded problems.

Here is the parts of the code that are relevent.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/MyDatabase.asp" -->
<%
Dim NewUser, NewID, NewFN, NewLN, NewUN, NewPass, NewEmail, savedata
Set NewUser = Server.CreateObject("ADODB.Recordset")
NewUser.ActiveConnection = MM_MyDatabase_STRING
NewUser.Source = "SELECT * FROM Users"
NewUser.CursorType = 3
NewUser.CursorLocation = 2
NewUser.LockType = 3
NewUser.Open
%>
<%
Function savedata()
            ' No First Name
If txtFName = "" then
response.redirect request.servervariables("script_name") & "?error=3"

            ' No Last Name
Else If TxtLName = "" then
response.redirect request.servervariables("script_name") & "?error=4"

            ' No UserName
Else If txtUserName = "" then
response.redirect request.servervariables("script_name") & "?error=5"

            ' No Email
Else If txtEmail1 = "" and txtEmail2 = "" then
response.redirect request.servervariables("script_name") & "?error=6"

            ' No Password         
Else If txtPassword1 = "" and txtPassword2 = "" then
response.redirect request.servervariables("script_name") & "?error=7"

            ' Email doen't match
Else If txtEmail <> "" and txtEmail2 <> "" and txtEmail1 <> txtEmail2 then
response.redirect request.servervariables("script_name") & "?error=2"

            ' Password doesn't match
Else If txtPassword1 <> txtPassword2 then
response.redirect request.servervariables("script_name") & "?error=1"

            ' Invalid Email 1
Else If Instr(request("txtemail1"), "@") < 2 or Instr(request("txtemail1"), "@") > Len("txtemail1")-5 then
response.redirect request.servervariables("script_name") & "?error=8"

            ' Invalid Email 2
Else If Instr(request("txtemail2"), "@") < 2 or Instr(request("txtemail2"), "@") > Len("txtemail2")-5 then
response.redirect request.servervariables("script_name") & "?error=8"
Else
ValForm ="complete"
End If
End If
End If
End If
End If
End If
End If
End If
End If
dim emailval
If Valform = "Complete" then
'If Request("txtUserName") <> "" and emailval <> "false" and Request("txtPassword2") <> "" and Request("txtPassword1") <> "" and Request("txtemail1") <> "" and Request("txtemail2") <> "" and Request("txtLName") <> "" and Request("txtfname") <> "" and Request("txtPassword1") = Request("txtPassword2") and Request("txtemail1") = Request("txtemail2") then
            session("MM_Password") = request.form("txtPassword1")
           
' ::: Find the Last Record ID and Add One
           
            ' ::: Setup the Variables
            NewUser.MoveLast
            NewID = NewUser.Fields.Item("UserID").value

            NewFN = Request("txtFName")
            NewLN = Request("txtLName")
            NewUN = Request("txtUserName")
            NewPass = Request("txtPassword1")
            NewEmail = Request("txtEmail1")
' ::: Add the new data
           
            'NewUser.AddNew
            'NewUser.Fields("FName") = NewFN
            'NewUser.Fields("LName") = NewLN
            'NewUser.Fields("UserName") = NewUN
            'NewUser.Fields("Password") = NewPass
            'NewUser.Fields("EmailAddress") = NewEmail
            'NewUser.Update
            'NewUser.Movelast
            ' :: check that it Saved
            'oldID= NewID
            'newID = newID +1
            'curID = NewUser.Fields.Item("UserID").value
            NewUser.Close
            Set NewUser = Nothing
            'If Oldid = CurID then
            'response.redirect "UserReg.asp"
                        'else If NewID = CurID then
                        'Response.redirect "UserLogin.asp"
                        'End If
            'End If
'End If
End If   
end function      
%>

<html>
<head>
<title>User Registration</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form ACTION="<%= request.servervariables("script_name")%>" method="POST" name="RegistrationForm" id="RegistrationForm">

  <table width="98%"  border="0" >
    <tr>
      <td> <div align="center"><font size="6" face="Arial, Helvetica, sans-serif"><strong>New
          User Registration</strong></font></div></td>
    </tr>
  </table>
  <p> <br>
    <%
' ::::: SEE IF AN ERROR CODE HAS BEEN PASSED. IF SO, DISPLAY THE
' ::::: APPROPRIATE MESSAGE
if request.querystring("error") <> "" then
select case request.querystring("error")
case "1"
var_error_msg = "The Password does not match. "
case "2"
var_error_msg = "The Email address does not match."
case "3"
var_error_msg = "You must enter first name."
case "4"
var_error_msg = "You must enter Last name."
case "5"
var_error_msg = "You must enter a UserName."
case "6"
var_error_msg = "You must enter a Email Address."
case "7"
var_error_msg = "You must enter a Password."
case "8"
var_error_msg = "This is not a valid email address."
Case else
var_error_msg = "An unspecified error occured."
end select

%>


Snipped
 

        <tr>
          <td><font size="4" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;</font></td>
          <td><font size="4" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;</font></td>
          <td><div align="right"><font size="4" face="Verdana, Arial, Helvetica, sans-serif">
              <input name="UserID" type="hidden" id="UserID" value="<%= Request.Form("UserID") %>">
              <input name="Register" type="submit" id="Register" value="Register"  onclick= "saveData">
              </font></div></td>
        </tr>
      </table>
      <br>
    </div>
  </div>
</form>
</body>
</html>


Any Help is greatly recieved


Thanks
Thunderchild
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> Onclick Help Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts