Keeping track of who submitted the form by their UserId

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Keeping track of who submitted the form by their UserId

    Hello All,

    I'm using ASP as my language. My users has to login to gain access to my form.
    What I what to do is when the user logs in I want them to only see the
    pervious entered records. The following are steps that I have taken to
    accomplish this task but not working properly.

    --------------------------------------------------------------------------------
    ---------------------------------
    SELECT Sales_ID, Client_Number, Client_Name, Client_Zip, AccountID
    FROM dbo.Client
    WHERE AccountID = MMColParam

    MMColParam is = Session("MM_UserID")

    --------------------------------------------------------------------------------
    ------------------------------------
    Inside my form I inserted a Hidden field and it has this value
    .....<%=(Client.Fields.Item("AccountID").Value)%>

    --------------------------------------------------------------------------------
    -------------------------------------

    This method only inserting in the first userID in the SQL Server database
    reguidless which user is submitting the form. Any advise would be greatly
    appreciated. Thanks.


    Mike1500 Guest

  2. Similar Questions and Discussions

    1. Keeping track of clientObj
      Hi there, I'm developing an application where I do some checking with another application using LoadVars before I allow a client to connect. My...
    2. keeping track of new additions to your scene
      Say I have a racetrack and different types of cars that get swapped in and out on a mousedown action. Is there a way to store ONLY the new models...
    3. Keeping track of checkmarks.
      Hello all, I have a pretty cool situation here that I thought I had figured out. I have a datagrid that is 4 columns bound to a table and...
    4. Opinions on keeping track of simple web stats with MS SQL Server/ASP.NET
      I know we have access to log files and web statistics can be pulled from those. But the guy who wants it built was thinking we should keep track of...
    5. Keeping track of which user controls need to be loaded and which not
      Hi all, What methods are used to keep track of when dynamic user controls must be loaded and when not? Regards John.
  3. #2

    Default Re: Keeping track of who submitted the form by their UserId

    You need to change the value of the hidden field to the value of the session
    variable if you want to insert the current user's ID.

    <% = session("MM_UserID") %>

    The value is already present in the session, just use that one instead of
    retrieving it from the DB and then inserting it.

    HTH,
    bT

    "Mike1500" <webforumsuser@macromedia.com> wrote in message
    news:d6u6ps$2q7$1@forums.macromedia.com...
    > Hello All,
    >
    > I'm using ASP as my language. My users has to login to gain access to my
    > form.
    > What I what to do is when the user logs in I want them to only see the
    > pervious entered records. The following are steps that I have taken to
    > accomplish this task but not working properly.
    >
    > --------------------------------------------------------------------------------
    > ---------------------------------
    > SELECT Sales_ID, Client_Number, Client_Name, Client_Zip, AccountID
    > FROM dbo.Client
    > WHERE AccountID = MMColParam
    >
    > MMColParam is = Session("MM_UserID")
    >
    > --------------------------------------------------------------------------------
    > ------------------------------------
    > Inside my form I inserted a Hidden field and it has this value
    > ....<%=(Client.Fields.Item("AccountID").Value)%>
    >
    > --------------------------------------------------------------------------------
    > -------------------------------------
    >
    > This method only inserting in the first userID in the SQL Server database
    > reguidless which user is submitting the form. Any advise would be greatly
    > appreciated. Thanks.
    >
    >

    Brandon Taylor Guest

  4. #3

    Default Re: Keeping track of who submitted the form by theirUserId

    this is your problem
    MMColParam is = Session("MM_UserID")
    you said you have a hidden form that posts the userid...but in your SQL
    statement you are passing a value from SESSIONS instead of a FORM...change that
    to
    MMColParam is = request.form("MM_UserID") and make sure the hidden field's
    name is "MM_UserID"

    nisav19 Guest

  5. #4

    Default Re: Keeping track of who submitted the form by theirUserId

    You can also set up a second recordset where the AccountID = Session Variable =
    MM_UserID. Then you can bind the name of the person (e.g. fname and lname)
    into the hidden field for submission in the form. Some userids can be cryptic
    and this option will give you an actual name.

    Cheers

    Chuck

    chuckomalley Guest

  6. #5

    Default Re: Keeping track of who submitted the form by theirUserId

    Thanks guys for the wonderful suggestion, but it did not work, maybe is an
    error on my part. I have include a copy of the code to this post hopfully it is
    helpful. Please help. Thanks.
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <!--#include file="Connections/Con_Sample.asp" -->
    <%
    ' *** Edit Operations: declare variables

    Dim MM_editAction
    Dim MM_abortEdit
    Dim MM_editQuery
    Dim MM_editCmd

    Dim MM_editConnection
    Dim MM_editTable
    Dim MM_editRedirectUrl
    Dim MM_editColumn
    Dim MM_recordId

    Dim MM_fieldsStr
    Dim MM_columnsStr
    Dim MM_fields
    Dim MM_columns
    Dim MM_typeArray
    Dim MM_formVal
    Dim MM_delim
    Dim MM_altVal
    Dim MM_emptyVal
    Dim MM_i

    MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
    If (Request.QueryString <> "") Then
    MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
    End If

    ' boolean to abort record edit
    MM_abortEdit = false

    ' query string to execute
    MM_editQuery = ""
    %>
    <%
    ' *** Insert Record: set variables

    If (CStr(Request("MM_insert")) = "form1") Then

    MM_editConnection = MM_Con_Sample_STRING
    MM_editTable = "dbo.Clients"
    MM_editRedirectUrl = "SalesApp.asp"
    MM_fieldsStr =
    "DSM|value|Sales|value|Entity|value|Client_Number| value|Client_Name|value|Client
    _Zip|value|Comments|value|Action_Item|value|Assign ed|value|Effective_Date|value"
    MM_columnsStr =
    "DSM_ID|',none,''|Sales_ID|',none,''|Entity|',none ,''|Client_Number|',none,''|Cl
    ient_Name|',none,''|Client_Zip|',none,''|Comments| ',none,''|Action_Item|',none,'
    '|Assigned|',none,''|Effective_Date|',none,''"

    ' create the MM_fields and MM_columns arrays
    MM_fields = Split(MM_fieldsStr, "|")
    MM_columns = Split(MM_columnsStr, "|")

    ' set the form values
    For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
    Next

    ' append the query string to the redirect URL
    If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And
    Request.QueryString <> "") Then
    MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
    MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
    End If

    End If
    %>
    <%
    ' *** Insert Record: construct a sql insert statement and execute it

    Dim MM_tableValues
    Dim MM_dbValues

    If (CStr(Request("MM_insert")) <> "") Then

    ' create the sql insert statement
    MM_tableValues = ""
    MM_dbValues = ""
    For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_formVal = MM_fields(MM_i+1)
    MM_typeArray = Split(MM_columns(MM_i+1),",")
    MM_delim = MM_typeArray(0)
    If (MM_delim = "none") Then MM_delim = ""
    MM_altVal = MM_typeArray(1)
    If (MM_altVal = "none") Then MM_altVal = ""
    MM_emptyVal = MM_typeArray(2)
    If (MM_emptyVal = "none") Then MM_emptyVal = ""
    If (MM_formVal = "") Then
    MM_formVal = MM_emptyVal
    Else
    If (MM_altVal <> "") Then
    MM_formVal = MM_altVal
    ElseIf (MM_delim = "'") Then ' escape quotes
    MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
    Else
    MM_formVal = MM_delim + MM_formVal + MM_delim
    End If
    End If
    If (MM_i <> LBound(MM_fields)) Then
    MM_tableValues = MM_tableValues & ","
    MM_dbValues = MM_dbValues & ","
    End If
    MM_tableValues = MM_tableValues & MM_columns(MM_i)
    MM_dbValues = MM_dbValues & MM_formVal
    Next
    MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ")
    values (" & MM_dbValues & ")"

    If (Not MM_abortEdit) Then
    ' execute the insert
    Set 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 <> "") Then
    Response.Redirect(MM_editRedirectUrl)
    End If
    End If

    End If
    %>
    <%
    Dim Action_Item
    Dim Action_Item_numRows

    Set Action_Item = Server.CreateObject("ADODB.Recordset")
    Action_Item.ActiveConnection = MM_Con_Sample_STRING
    Action_Item.Source = "SELECT Action_Item FROM dbo.Action_List"
    Action_Item.CursorType = 0
    Action_Item.CursorLocation = 2
    Action_Item.LockType = 1
    Action_Item.Open()

    Action_Item_numRows = 0
    %>
    <%
    Dim Assigned_Rep
    Dim Assigned_Rep_numRows

    Set Assigned_Rep = Server.CreateObject("ADODB.Recordset")
    Assigned_Rep.ActiveConnection = MM_Con_Sample_STRING
    Assigned_Rep.Source = "SELECT Assigned FROM dbo.Assigned_Rep"
    Assigned_Rep.CursorType = 0
    Assigned_Rep.CursorLocation = 2
    Assigned_Rep.LockType = 1
    Assigned_Rep.Open()

    Assigned_Rep_numRows = 0
    %>
    <%
    Dim Effective_Date
    Dim Effective_Date_numRows

    Set Effective_Date = Server.CreateObject("ADODB.Recordset")
    Effective_Date.ActiveConnection = MM_Con_Sample_STRING
    Effective_Date.Source = "SELECT Effective_Date FROM dbo.Effective_Date"
    Effective_Date.CursorType = 0
    Effective_Date.CursorLocation = 2
    Effective_Date.LockType = 1
    Effective_Date.Open()

    Effective_Date_numRows = 0
    %>
    <%
    Dim Entity
    Dim Entity_numRows

    Set Entity = Server.CreateObject("ADODB.Recordset")
    Entity.ActiveConnection = MM_Con_Sample_STRING
    Entity.Source = "SELECT Entity FROM dbo.Entity"
    Entity.CursorType = 0
    Entity.CursorLocation = 2
    Entity.LockType = 1
    Entity.Open()

    Entity_numRows = 0
    %>
    <%
    Dim Previously_Entered__MMColParam
    Previously_Entered__MMColParam = "1"
    If (Session("MM_UserID") <> "") Then
    Previously_Entered__MMColParam = Session("MM_UserID")
    End If
    %>
    <%
    Dim Previously_Entered
    Dim Previously_Entered_numRows

    Set Previously_Entered = Server.CreateObject("ADODB.Recordset")
    Previously_Entered.ActiveConnection = MM_Con_Sample_STRING
    Previously_Entered.Source = "SELECT DSM_ID, Sales_ID, Client_Number,
    Client_Name, Client_Zip, Action_Item, Assigned, Effective_Date, Entity, Status,
    AccountID FROM dbo.Clients WHERE AccountID = " +
    Replace(Previously_Entered__MMColParam, "'", "''") + ""
    Previously_Entered.CursorType = 0
    Previously_Entered.CursorLocation = 2
    Previously_Entered.LockType = 1
    Previously_Entered.Open()

    Previously_Entered_numRows = 0
    %>
    <%
    Dim Clients
    Dim Clients_numRows

    Set Clients = Server.CreateObject("ADODB.Recordset")
    Clients.ActiveConnection = MM_Con_Sample_STRING
    Clients.Source = "SELECT Client_Number, Client_Name, Client_Zip, Comments,
    Action_Item, Assigned, Effective_Date, Entity, Status, DSM_Submit_Date,
    Rep_Submit_Date, AccountID FROM dbo.Clients"
    Clients.CursorType = 0
    Clients.CursorLocation = 2
    Clients.LockType = 1
    Clients.Open()

    Clients_numRows = 0
    %>
    <%
    Dim Sales
    Dim Sales_numRows

    Set Sales = Server.CreateObject("ADODB.Recordset")
    Sales.ActiveConnection = MM_Con_Sample_STRING
    Sales.Source = "SELECT Sales_ID, DSM_ID, First_Name, Last_Name FROM dbo.Sales"
    Sales.CursorType = 0
    Sales.CursorLocation = 2
    Sales.LockType = 1
    Sales.Open()

    Sales_numRows = 0
    %>
    <%
    Dim DSM
    Dim DSM_numRows

    Set DSM = Server.CreateObject("ADODB.Recordset")
    DSM.ActiveConnection = MM_Con_Sample_STRING
    DSM.Source = "SELECT DSM_ID FROM dbo.DSM"
    DSM.CursorType = 0
    DSM.CursorLocation = 2
    DSM.LockType = 1
    DSM.Open()

    DSM_numRows = 0
    %>
    <%
    Dim rs_Submit__MMColParam
    rs_Submit__MMColParam = "1"
    If (Session("MM_Username") <> "") Then
    rs_Submit__MMColParam = Session("MM_Username")
    End If
    %>
    <%
    Dim rs_Submit
    Dim rs_Submit_numRows

    Set rs_Submit = Server.CreateObject("ADODB.Recordset")
    rs_Submit.ActiveConnection = MM_Con_Sample_STRING
    rs_Submit.Source = "SELECT Submitted_By FROM dbo.Users WHERE username = '" +
    Replace(rs_Submit__MMColParam, "'", "''") + "'"
    rs_Submit.CursorType = 0
    rs_Submit.CursorLocation = 2
    rs_Submit.LockType = 1
    rs_Submit.Open()

    rs_Submit_numRows = 0
    %>
    <%
    Dim Users
    Dim Users_numRows

    Set Users = Server.CreateObject("ADODB.Recordset")
    Users.ActiveConnection = MM_Con_Sample_STRING
    Users.Source = "SELECT AccountID, first_Name, last_Name FROM dbo.Users"
    Users.CursorType = 0
    Users.CursorLocation = 2
    Users.LockType = 1
    Users.Open()

    Users_numRows = 0
    %>
    <%
    Dim Repeat1__numRows
    Dim Repeat1__index

    Repeat1__numRows = -1
    Repeat1__index = 0
    Previously_Entered_numRows = Previously_Entered_numRows + Repeat1__numRows
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    <script language="JavaScript" type="text/JavaScript">
    <!--

    function MM_findObj(n, d) { //v4.01
    var p,i,x; if(!d) d=document;
    if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)
    x=d.forms[n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++)
    x=MM_findObj(n,d.layers.document);
    if(!x && d.getElementById) x=d.getElementById(n); return x;
    }

    function MM_validateForm() { //v4.0
    var i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args);
    if (val) { nm=val.name; if ((val=val.value)!="") {
    if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
    if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail
    address.\n';
    } else if (test!='R') { num = parseFloat(val);
    if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
    if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
    min=test.substring(8,p); max=test.substring(p+1);
    if (num<min || max<num) errors+='- '+nm+' must contain a number
    between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n';
    }
    } if (errors) alert('The following error(s) occurred:
    Mike1500 Guest

  7. #6

    Default Re: Keeping track of who submitted the form by their UserId

    The login behavior creates Session("MM_Username"), not Session("MM_UserID")

    "Mike1500" <webforumsuser@macromedia.com> wrote in message
    news:d6vk3b$74s$1@forums.macromedia.com...
    > Thanks guys for the wonderful suggestion, but it did not work, maybe is an
    > error on my part. I have include a copy of the code to this post hopfully
    > it is
    > helpful. Please help. Thanks.
    > <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    > <!--#include file="Connections/Con_Sample.asp" -->
    > <%
    > ' *** Edit Operations: declare variables
    >
    > Dim MM_editAction
    > Dim MM_abortEdit
    > Dim MM_editQuery
    > Dim MM_editCmd
    >
    > Dim MM_editConnection
    > Dim MM_editTable
    > Dim MM_editRedirectUrl
    > Dim MM_editColumn
    > Dim MM_recordId
    >
    > Dim MM_fieldsStr
    > Dim MM_columnsStr
    > Dim MM_fields
    > Dim MM_columns
    > Dim MM_typeArray
    > Dim MM_formVal
    > Dim MM_delim
    > Dim MM_altVal
    > Dim MM_emptyVal
    > Dim MM_i
    >
    > MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
    > If (Request.QueryString <> "") Then
    > MM_editAction = MM_editAction & "?" &
    > Server.HTMLEncode(Request.QueryString)
    > End If
    >
    > ' boolean to abort record edit
    > MM_abortEdit = false
    >
    > ' query string to execute
    > MM_editQuery = ""
    > %>
    > <%
    > ' *** Insert Record: set variables
    >
    > If (CStr(Request("MM_insert")) = "form1") Then
    >
    > MM_editConnection = MM_Con_Sample_STRING
    > MM_editTable = "dbo.Clients"
    > MM_editRedirectUrl = "SalesApp.asp"
    > MM_fieldsStr =
    > "DSM|value|Sales|value|Entity|value|Client_Number| value|Client_Name|value|Client
    > _Zip|value|Comments|value|Action_Item|value|Assign ed|value|Effective_Date|value"
    > MM_columnsStr =
    > "DSM_ID|',none,''|Sales_ID|',none,''|Entity|',none ,''|Client_Number|',none,''|Cl
    > ient_Name|',none,''|Client_Zip|',none,''|Comments| ',none,''|Action_Item|',none,'
    > '|Assigned|',none,''|Effective_Date|',none,''"
    >
    > ' create the MM_fields and MM_columns arrays
    > MM_fields = Split(MM_fieldsStr, "|")
    > MM_columns = Split(MM_columnsStr, "|")
    >
    > ' set the form values
    > For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    > MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
    > Next
    >
    > ' append the query string to the redirect URL
    > If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    > If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And
    > Request.QueryString <> "") Then
    > MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    > Else
    > MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    > End If
    > End If
    >
    > End If
    > %>
    > <%
    > ' *** Insert Record: construct a sql insert statement and execute it
    >
    > Dim MM_tableValues
    > Dim MM_dbValues
    >
    > If (CStr(Request("MM_insert")) <> "") Then
    >
    > ' create the sql insert statement
    > MM_tableValues = ""
    > MM_dbValues = ""
    > For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    > MM_formVal = MM_fields(MM_i+1)
    > MM_typeArray = Split(MM_columns(MM_i+1),",")
    > MM_delim = MM_typeArray(0)
    > If (MM_delim = "none") Then MM_delim = ""
    > MM_altVal = MM_typeArray(1)
    > If (MM_altVal = "none") Then MM_altVal = ""
    > MM_emptyVal = MM_typeArray(2)
    > If (MM_emptyVal = "none") Then MM_emptyVal = ""
    > If (MM_formVal = "") Then
    > MM_formVal = MM_emptyVal
    > Else
    > If (MM_altVal <> "") Then
    > MM_formVal = MM_altVal
    > ElseIf (MM_delim = "'") Then ' escape quotes
    > MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
    > Else
    > MM_formVal = MM_delim + MM_formVal + MM_delim
    > End If
    > End If
    > If (MM_i <> LBound(MM_fields)) Then
    > MM_tableValues = MM_tableValues & ","
    > MM_dbValues = MM_dbValues & ","
    > End If
    > MM_tableValues = MM_tableValues & MM_columns(MM_i)
    > MM_dbValues = MM_dbValues & MM_formVal
    > Next
    > MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues &
    > ")
    > values (" & MM_dbValues & ")"
    >
    > If (Not MM_abortEdit) Then
    > ' execute the insert
    > Set 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 <> "") Then
    > Response.Redirect(MM_editRedirectUrl)
    > End If
    > End If
    >
    > End If
    > %>
    > <%
    > Dim Action_Item
    > Dim Action_Item_numRows
    >
    > Set Action_Item = Server.CreateObject("ADODB.Recordset")
    > Action_Item.ActiveConnection = MM_Con_Sample_STRING
    > Action_Item.Source = "SELECT Action_Item FROM dbo.Action_List"
    > Action_Item.CursorType = 0
    > Action_Item.CursorLocation = 2
    > Action_Item.LockType = 1
    > Action_Item.Open()
    >
    > Action_Item_numRows = 0
    > %>
    > <%
    > Dim Assigned_Rep
    > Dim Assigned_Rep_numRows
    >
    > Set Assigned_Rep = Server.CreateObject("ADODB.Recordset")
    > Assigned_Rep.ActiveConnection = MM_Con_Sample_STRING
    > Assigned_Rep.Source = "SELECT Assigned FROM dbo.Assigned_Rep"
    > Assigned_Rep.CursorType = 0
    > Assigned_Rep.CursorLocation = 2
    > Assigned_Rep.LockType = 1
    > Assigned_Rep.Open()
    >
    > Assigned_Rep_numRows = 0
    > %>
    > <%
    > Dim Effective_Date
    > Dim Effective_Date_numRows
    >
    > Set Effective_Date = Server.CreateObject("ADODB.Recordset")
    > Effective_Date.ActiveConnection = MM_Con_Sample_STRING
    > Effective_Date.Source = "SELECT Effective_Date FROM dbo.Effective_Date"
    > Effective_Date.CursorType = 0
    > Effective_Date.CursorLocation = 2
    > Effective_Date.LockType = 1
    > Effective_Date.Open()
    >
    > Effective_Date_numRows = 0
    > %>
    > <%
    > Dim Entity
    > Dim Entity_numRows
    >
    > Set Entity = Server.CreateObject("ADODB.Recordset")
    > Entity.ActiveConnection = MM_Con_Sample_STRING
    > Entity.Source = "SELECT Entity FROM dbo.Entity"
    > Entity.CursorType = 0
    > Entity.CursorLocation = 2
    > Entity.LockType = 1
    > Entity.Open()
    >
    > Entity_numRows = 0
    > %>
    > <%
    > Dim Previously_Entered__MMColParam
    > Previously_Entered__MMColParam = "1"
    > If (Session("MM_UserID") <> "") Then
    > Previously_Entered__MMColParam = Session("MM_UserID")
    > End If
    > %>
    > <%
    > Dim Previously_Entered
    > Dim Previously_Entered_numRows
    >
    > Set Previously_Entered = Server.CreateObject("ADODB.Recordset")
    > Previously_Entered.ActiveConnection = MM_Con_Sample_STRING
    > Previously_Entered.Source = "SELECT DSM_ID, Sales_ID, Client_Number,
    > Client_Name, Client_Zip, Action_Item, Assigned, Effective_Date, Entity,
    > Status,
    > AccountID FROM dbo.Clients WHERE AccountID = " +
    > Replace(Previously_Entered__MMColParam, "'", "''") + ""
    > Previously_Entered.CursorType = 0
    > Previously_Entered.CursorLocation = 2
    > Previously_Entered.LockType = 1
    > Previously_Entered.Open()
    >
    > Previously_Entered_numRows = 0
    > %>
    > <%
    > Dim Clients
    > Dim Clients_numRows
    >
    > Set Clients = Server.CreateObject("ADODB.Recordset")
    > Clients.ActiveConnection = MM_Con_Sample_STRING
    > Clients.Source = "SELECT Client_Number, Client_Name, Client_Zip, Comments,
    > Action_Item, Assigned, Effective_Date, Entity, Status, DSM_Submit_Date,
    > Rep_Submit_Date, AccountID FROM dbo.Clients"
    > Clients.CursorType = 0
    > Clients.CursorLocation = 2
    > Clients.LockType = 1
    > Clients.Open()
    >
    > Clients_numRows = 0
    > %>
    > <%
    > Dim Sales
    > Dim Sales_numRows
    >
    > Set Sales = Server.CreateObject("ADODB.Recordset")
    > Sales.ActiveConnection = MM_Con_Sample_STRING
    > Sales.Source = "SELECT Sales_ID, DSM_ID, First_Name, Last_Name FROM
    > dbo.Sales"
    > Sales.CursorType = 0
    > Sales.CursorLocation = 2
    > Sales.LockType = 1
    > Sales.Open()
    >
    > Sales_numRows = 0
    > %>
    > <%
    > Dim DSM
    > Dim DSM_numRows
    >
    > Set DSM = Server.CreateObject("ADODB.Recordset")
    > DSM.ActiveConnection = MM_Con_Sample_STRING
    > DSM.Source = "SELECT DSM_ID FROM dbo.DSM"
    > DSM.CursorType = 0
    > DSM.CursorLocation = 2
    > DSM.LockType = 1
    > DSM.Open()
    >
    > DSM_numRows = 0
    > %>
    > <%
    > Dim rs_Submit__MMColParam
    > rs_Submit__MMColParam = "1"
    > If (Session("MM_Username") <> "") Then
    > rs_Submit__MMColParam = Session("MM_Username")
    > End If
    > %>
    > <%
    > Dim rs_Submit
    > Dim rs_Submit_numRows
    >
    > Set rs_Submit = Server.CreateObject("ADODB.Recordset")
    > rs_Submit.ActiveConnection = MM_Con_Sample_STRING
    > rs_Submit.Source = "SELECT Submitted_By FROM dbo.Users WHERE username =
    > '" +
    > Replace(rs_Submit__MMColParam, "'", "''") + "'"
    > rs_Submit.CursorType = 0
    > rs_Submit.CursorLocation = 2
    > rs_Submit.LockType = 1
    > rs_Submit.Open()
    >
    > rs_Submit_numRows = 0
    > %>
    > <%
    > Dim Users
    > Dim Users_numRows
    >
    > Set Users = Server.CreateObject("ADODB.Recordset")
    > Users.ActiveConnection = MM_Con_Sample_STRING
    > Users.Source = "SELECT AccountID, first_Name, last_Name FROM dbo.Users"
    > Users.CursorType = 0
    > Users.CursorLocation = 2
    > Users.LockType = 1
    > Users.Open()
    >
    > Users_numRows = 0
    > %>
    > <%
    > Dim Repeat1__numRows
    > Dim Repeat1__index
    >
    > Repeat1__numRows = -1
    > Repeat1__index = 0
    > Previously_Entered_numRows = Previously_Entered_numRows + Repeat1__numRows
    > %>
    > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    > <html xmlns="http://www.w3.org/1999/xhtml">
    > <head>
    > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    > <title>Untitled Document</title>
    > <script language="JavaScript" type="text/JavaScript">
    > <!--
    >
    > function MM_findObj(n, d) { //v4.01
    > var p,i,x; if(!d) d=document;
    > if((p=n.indexOf("?"))>0&&parent.frames.length) {
    > d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    > if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)
    > x=d.forms[n];
    > for(i=0;!x&&d.layers&&i<d.layers.length;i++)
    > x=MM_findObj(n,d.layers.document);
    > if(!x && d.getElementById) x=d.getElementById(n); return x;
    > }
    >
    > function MM_validateForm() { //v4.0
    > var i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
    > for (i=0; i<(args.length-2); i+=3) { test=args[i+2];
    > val=MM_findObj(args);
    > if (val) { nm=val.name; if ((val=val.value)!="") {
    > if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
    > if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an
    > e-mail
    > address.\n';
    > } else if (test!='R') { num = parseFloat(val);
    > if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
    > if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
    > min=test.substring(8,p); max=test.substring(p+1);
    > if (num<min || max<num) errors+='- '+nm+' must contain a number
    > between '+min+' and '+max+'.\n';
    > } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is
    > required.\n';
    > }
    > } if (errors) alert('The following error(s) occurred:

    Lionstone Guest

  8. #7

    Default Re: Keeping track of who submitted the form by theirUserId

    after you updated the hidden field code, did you update the INSERT behavior?
    looking at what you posted

    ----------------------------
    MM_fieldsStr =
    "DSM|value|Sales|value|Entity|value|Client_Number| value|Client_Name|value|Client
    _Zip|value|Comments|value|Action_Item|value|Assign ed|value|Effective_Date|value"
    MM_columnsStr =
    "DSM_ID|',none,''|Sales_ID|',none,''|Entity|',none ,''|Client_Number|',none,''|Cl
    ient_Name|',none,''|Client_Zip|',none,''|Comments| ',none,''|Action_Item|',none,'
    '|Assigned|',none,''|Effective_Date|',none,''"
    -------------------------

    i dont think you did, thus INSERT Statement doesnt know that you have a hidden
    field that you want to insert into the db. double click on your insert
    behavior let it update itself and also check to make sure the MM_UserID is
    actually listed there..

    i think you can dismiss what Lionstone said, because i dont think he noticed
    that you have 2 different sessions one for MM_Username the other for MM_UserID,
    unless he was referring to something else.


    nisav19 Guest

  9. #8

    Default Re: Keeping track of who submitted the form by theirUserId

    Thanks nisav19 for help, but it still not working, when Add the MM_UserID in
    the code below MX automatically change it back to HiddenField. Please help.
    Thanks.

    MM_fieldsStr =
    "DSM|value|Sales|value|Entity|value|Client_Number| value|Client_Name|value|Hidden
    Field|value|Client_Zip|value|Comments|value|Action _Item|value|Assigned|value|Eff
    ective_Date|value"
    MM_columnsStr =
    "DSM_ID|',none,''|Sales_ID|',none,''|Entity|',none ,''|Client_Number|',none,''|Cl
    ient_Name|',none,''|AccountID|none,none,NULL|Clien t_Zip|',none,''|Comments|',non
    e,''|Action_Item|',none,''|Assigned|',none,''|Effe ctive_Date|',none,''"

    Mike1500 Guest

  10. #9

    Default Re: Keeping track of who submitted the form by theirUserId

    All,

    I've changed my code to the following:

    MM_fieldsStr =
    "DSM|value|Sales|value|Entity|value|Client_Number| value|Client_Name|value|MM_Use
    rID|value|Client_Zip|value|Comments|value|Action_I tem|value|Assigned|value|Effec
    tive_Date|value"
    MM_columnsStr =
    "DSM_ID|',none,''|Sales_ID|',none,''|Entity|',none ,''|Client_Number|',none,''|Cl
    ient_Name|',none,''|AccountID|',none,''|Client_Zip |',none,''|Comments|',none,''|
    Action_Item|',none,''|Assigned|',none,''|Effective _Date|',none,''"

    --------------------------------------------------------------------------------
    -----------------------------
    Can ayone tell me why I'm always getting 0 for my AccoundID column?? Please
    help. Thanks.


    Mike1500 Guest

  11. #10

    Default Re: Keeping track of who submitted the form by theirUserId

    i copied your code from here into dreamweaver to play around with and heres
    what i found
    the hidden field...right now its named MM_UserID..when you click the insert
    behavior to make modifications...it doesnt recognize MM_UserID...most likely
    because of the MM_ it recognizes that its a dreamweaver created item...but if
    you change the name to anything else that doenst have MM_ in the front and then
    go into the insert behavior..then its listed in there and you can assign where
    its going to be inserted and drewamweaver should update the code properly...

    nisav19 Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139