www.webdeveloper.com
Results 1 to 2 of 2

Thread: Registration Form - ASP JavaScript (Help Me Please)

  1. #1
    Join Date
    Oct 2006
    Posts
    21

    Registration Form - ASP JavaScript (Help Me Please)

    Hello..

    I had encountered a problem so would like you to solve my problem for registration page.. I am using ASP JavaScript language because I am needed to add calendar (pop-up) in other filename page..

    1) I click "create user" button, go to dreamweaver's server behaviour select "insert record" then add the database connection and etc...

    2) I have to close the dreamweaver program and open it again because the database is sensitive.. Once I open the dreamweaver program, I go to login page and it proceed to home.asp then i was trying to select "create user" page then it displays error like this:

    ----------------------------------------------------------------------
    Error Type:
    Microsoft JScript runtime (0x800A1391)
    'createUser_site' is undefined
    /armsystem/siteAdminCreateUser.asp, line 356

    From Line 355 to 357:
    <%
    createUser_site.Close();
    %>

    ----------------------------------------------------------------------
    From line 18 to 43:
    <%
    // *** Insert Record: set variables

    if (String(Request("MM_insert")) == "createUser_site") {

    var MM_editConnection = MM_armsystem_STRING;
    var MM_editTable = "Particulars";
    var MM_editRedirectUrl = "siteAdminAssignConf.asp";
    var MM_fieldsStr = "txtFirstName|value|txtLastName|value|txtName|value|txtLogin|value|txtPwd|value|txtCfmPwd|value" ;
    var MM_columnsStr = "[First Name]|',none,''|[Last Name]|',none,''|[Officer Name]|',none,''|Login|',none,''|Password|',none,''|[Confirm Password]|',none,''";

    // create the MM_fields and MM_columns arrays
    var MM_fields = MM_fieldsStr.split("|");
    var MM_columns = MM_columnsStr.split("|");

    // set the form values
    for (var i=0; i+1 < MM_fields.length; i+=2) {
    MM_fields[i+1] = String(Request.Form(MM_fields[i]));
    }

    // append the query string to the redirect URL
    if (MM_editRedirectUrl && Request.QueryString && Request.QueryString.Count > 0) {
    MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1)?"?":"&") + Request.QueryString;
    }
    }
    %>
    ------------------------------------------------------------------------
    From line 44 to 87:
    <%
    // *** Insert Record: construct a sql insert statement and execute it

    if (String(Request("MM_insert")) != "undefined") {

    // create the sql insert statement
    var MM_tableValues = "", MM_dbValues = "";
    for (var i=0; i+1 < MM_fields.length; i+=2) {
    var formVal = MM_fields[i+1];
    var MM_typesArray = MM_columns[i+1].split(",");
    var delim = (MM_typesArray[0] != "none") ? MM_typesArray[0] : "";
    var altVal = (MM_typesArray[1] != "none") ? MM_typesArray[1] : "";
    var emptyVal = (MM_typesArray[2] != "none") ? MM_typesArray[2] : "";
    if (formVal == "" || formVal == "undefined") {
    formVal = emptyVal;
    } else {
    if (altVal != "") {
    formVal = altVal;
    } else if (delim == "'") { // escape quotes
    formVal = "'" + formVal.replace(/'/g,"''") + "'";
    } else {
    formVal = delim + formVal + delim;
    }
    }
    MM_tableValues += ((i != 0) ? "," : "") + MM_columns[i];
    MM_dbValues += ((i != 0) ? "," : "") + formVal;
    }
    MM_editQuery = "insert into " + MM_editTable + " (" + MM_tableValues + ") values (" + MM_dbValues + ")";

    if (!MM_abortEdit) {
    // execute the insert
    var MM_editCmd = Server.CreateObject('ADODB.Command');
    MM_editCmd.ActiveConnection = MM_editConnection;
    MM_editCmd.CommandText = MM_editQuery;
    MM_editCmd.Execute();
    MM_editCmd.ActiveConnection.Close();

    if (MM_editRedirectUrl) {
    Response.Redirect(MM_editRedirectUrl);
    }
    }

    }
    %>
    -------------------------------------------------------------------------
    Please help me how to solve my problem.. Thanks a lot!!

  2. #2
    Join Date
    Oct 2006
    Posts
    21
    Hello..

    This is the latest amendment I encountered a error problem.. Please ignore the first message I ask for help.. Please help me solve this problem.. Thanks!!

    Steps What I am supposed to do:
    1) I click "create user" button, go to dreamweaver's server behaviour select "insert record" then add the database connection and etc...

    2) I have to close the dreamweaver program and open it again because the database is sensitive.. Once I open the dreamweaver program, I go to login page and it proceed to home.asp then i was trying to select "create user" page then it displays error like this:

    Error Type:
    Microsoft JET Database Engine (0x80040E14)
    Syntax error in INSERT INTO statement.
    /armsystem/siteAdminCreateUser.asp, line 139

    Line 139: MM_editCmd.Execute();

    -----------------------------------------------------------------------
    <%
    // *** Redirect if username exists
    var MM_flag="MM_insert";
    if (String(Request(MM_flag)) != "undefined") {
    var MM_dupKeyRedirect="siteAdminCreateUserError.asp";
    var MM_rsKeyConnection=MM_armsystem_STRING;
    var MM_dupKeyFirstNameValue = String(Request.Form("txtFirstName"));
    var MM_dupKeyLastNameValue = String(Request.Form("txtLastName"));
    var MM_dupKeyUsernameValue = String(Request.Form("txtName"));
    var MM_dupKeyLoginValue = String(Request.Form("txtLogin"));
    var MM_dupKeyPasswordValue = String(Request.Form("txtPassword"));

    var MM_dupKeySQL = "SELECT OfficerName FROM tbl_Particulars WHERE OfficerName='" + MM_dupKeyFirstNameValue.replace(/'/g, "''") + MM_dupKeyLastNameValue.replace(/'/g, "''") + MM_dupKeyUsernameValue.replace(/'/g, "''") + MM_dupKeyLoginValue.replace(/'/g, "''") + MM_dupKeyPasswordValue.replace(/'/g, "''") + "'"

    var MM_adodbRecordset = "ADODB.Recordset";
    var MM_rsKey = Server.CreateObject(MM_adodbRecordset);
    MM_rsKey.ActiveConnection = MM_rsKeyConnection;
    MM_rsKey.Source = MM_dupKeySQL;
    MM_rsKey.CursorType=0;
    MM_rsKey.CursorLocation=2;
    MM_rsKey.LockType=3;
    MM_rsKey.Open();
    if (!MM_rsKey.EOF || !MM_rsKey.BOF) {
    // the username was found - can not add the requested username
    var MM_qsChar = "?";
    if (MM_dupKeyRedirect.indexOf("?") >= 0) MM_qsChar = "&";
    MM_dupKeyRedirect = MM_dupKeyRedirect + MM_qsChar + "requsername=" + MM_dupKeyUsernameValue;
    Response.Redirect(MM_dupKeyRedirect);
    }
    MM_rsKey.Close();
    }
    %>
    -------------------------------------------------------------------------
    <%
    if (String(Request("btnCreateUser"))!="undefined") {
    Response.Cookies("txtLogin") = Request.Form("txtLogin");
    var today = new Date();
    today.setDate(today.getDate()+30);
    Response.Cookies("txtLogin").Expires = (today.getMonth()+1)+"/"+today.getDate()+"/"+today.getFullYear();
    }
    %>
    -------------------------------------------------------------------------
    <%
    // *** Insert Record: set variables

    if (String(Request("MM_insert")) == "createUser_site") {

    var MM_editConnection = MM_armsystem_STRING;
    var MM_editTable = "tbl_Particulars";
    var MM_editRedirectUrl = "siteAdminAssignConf.asp";
    var MM_fieldsStr = "txtFirstName|value|txtLastName|value|txtName|value|txtLogin|value|txtPwd|value";
    var MM_columnsStr ="FirstName|',none,''|LastName|',none,''|OfficerName|',none,''|Login|',none,''|Password|',none,'' ";

    // create the MM_fields and MM_columns arrays
    var MM_fields = MM_fieldsStr.split("|");
    var MM_columns = MM_columnsStr.split("|");

    // set the form values
    for (var i=0; i+1 < MM_fields.length; i+=2) {
    MM_fields[i+1] = String(Request.Form(MM_fields[i]));
    }

    // append the query string to the redirect URL
    if (MM_editRedirectUrl && Request.QueryString && Request.QueryString.Count > 0) {
    MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1)?"?":"&") + Request.QueryString;
    }
    }
    %>
    -------------------------------------------------------------------------
    <%
    // *** Insert Record: construct a sql insert statement and execute it

    if (String(Request("MM_insert")) != "undefined") {

    // create the sql insert statement
    var MM_tableValues = "", MM_dbValues = "";
    for (var i=0; i+1 < MM_fields.length; i+=2) {
    var formVal = MM_fields[i+1];
    var MM_typesArray = MM_columns[i+1].split(",");
    var delim = (MM_typesArray[0] != "none") ? MM_typesArray[0] : "";
    var altVal = (MM_typesArray[1] != "none") ? MM_typesArray[1] : "";
    var emptyVal = (MM_typesArray[2] != "none") ? MM_typesArray[2] : "";
    if (formVal == "" || formVal == "undefined") {
    formVal = emptyVal;
    } else {
    if (altVal != "") {
    formVal = altVal;
    } else if (delim == "'") { // escape quotes
    formVal = "'" + formVal.replace(/'/g,"''") + "'";
    } else {
    formVal = delim + formVal + delim;
    }
    }
    MM_tableValues += ((i != 0) ? "," : "") + MM_columns[i];
    MM_dbValues += ((i != 0) ? "," : "") + formVal;
    }

    MM_editQuery = "insert into " + MM_editTable + " (" + MM_tableValues + ") values (" + MM_dbValues + ")";

    if (!MM_abortEdit) {
    // execute the insert
    var MM_editCmd = Server.CreateObject('ADODB.Command');
    MM_editCmd.ActiveConnection = MM_editConnection;
    MM_editCmd.CommandText = MM_editQuery;
    MM_editCmd.Execute();
    MM_editCmd.ActiveConnection.Close();

    if (MM_editRedirectUrl) {
    Response.Redirect(MM_editRedirectUrl);
    }
    }

    }
    %>
    -------------------------------------------------------------------------
    Please help me how to solve my problem.. Thanks a lot!!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.10671 seconds
  • Memory Usage 2,857KB
  • Queries Executed 13 (?)
More Information
Template Usage (32):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (2)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates