Submit button Question

Discussion in 'ASP General' started by Rich Cooper, Jun 29, 2004.

  1. Rich Cooper

    Rich Cooper Guest

    hi, i have a small problme hopfeully there is a simple sollution. I have a
    submit button on my page and when a user clicks on it i want them to be able
    to change a value is the table doc_profile from Y to N. Here is what i have
    so far but it gives me an error in my code. can you write sql code in
    vbscript fuctions?

    function btnundelete_OnClick
    dim oElement, oElements, oCkbox, oconn, rs, ssql, sconnstr
    dim bFound, sPIDList, i
    Cnt iCnt = 0
    bFound = false s
    ConnStr = session("ConnStr")
    Set oConn = Server.CreateObject("ADODB.Connection")
    oConn.Open sConnStr
    oConn.CursorLocation = 3
    oConn.CommandTimeout = 0
    set rs = Server.CreateObject("adodb.Recordset") rs.CursorLocation = 3
    set oElements = document.frmTL.elements
    for Each oElement in oElements
    if oElement.type= "checkbox" and oElement.checked = true then s
    PIDList = sPIDList & " '" & oElement.value & "',"
    iCnt = iCnt + 1
    end if
    next
    if len(sPIDList) > 0 then
    sPIDList = mid(sPidList, 1, len(sPidlist) - 1)
    end if
    if iCnt > 0 then
    msgbox(icnt)
    msgbox(spidlist)
    sSql = "update doc_profile set deleteflag = 'n' from doc_profile where pid
    =" & spid
    set rs = oConn.Execute(sSql)
    rs.Close
    else call msgbox ("Please make a selction before Undeleting a Doctor.",
    vbOKOnly + vbInformation, "Target List")
    end if
    end function


    Any help would be great
     
    Rich Cooper, Jun 29, 2004
    #1
    1. Advertising

  2. Rich Cooper

    Ken Schaefer Guest

    Maybe it would help if you told us what the error actually is.

    Cheers
    Ken


    "Rich Cooper" <> wrote in message
    news:%23cj%...
    : hi, i have a small problme hopfeully there is a simple sollution. I have
    a
    : submit button on my page and when a user clicks on it i want them to be
    able
    : to change a value is the table doc_profile from Y to N. Here is what i
    have
    : so far but it gives me an error in my code. can you write sql code in
    : vbscript fuctions?
    :
    : function btnundelete_OnClick
    : dim oElement, oElements, oCkbox, oconn, rs, ssql, sconnstr
    : dim bFound, sPIDList, i
    : Cnt iCnt = 0
    : bFound = false s
    : ConnStr = session("ConnStr")
    : Set oConn = Server.CreateObject("ADODB.Connection")
    : oConn.Open sConnStr
    : oConn.CursorLocation = 3
    : oConn.CommandTimeout = 0
    : set rs = Server.CreateObject("adodb.Recordset") rs.CursorLocation = 3
    : set oElements = document.frmTL.elements
    : for Each oElement in oElements
    : if oElement.type= "checkbox" and oElement.checked = true then s
    : PIDList = sPIDList & " '" & oElement.value & "',"
    : iCnt = iCnt + 1
    : end if
    : next
    : if len(sPIDList) > 0 then
    : sPIDList = mid(sPidList, 1, len(sPidlist) - 1)
    : end if
    : if iCnt > 0 then
    : msgbox(icnt)
    : msgbox(spidlist)
    : sSql = "update doc_profile set deleteflag = 'n' from doc_profile where pid
    : =" & spid
    : set rs = oConn.Execute(sSql)
    : rs.Close
    : else call msgbox ("Please make a selction before Undeleting a Doctor.",
    : vbOKOnly + vbInformation, "Target List")
    : end if
    : end function
    :
    :
    : Any help would be great
    :
    :
     
    Ken Schaefer, Jun 29, 2004
    #2
    1. Advertising

  3. Rich Cooper

    Rich Cooper Guest

    the error is it won't chnage that value in my table from y to n. It says
    error on page.
    "Ken Schaefer" <> wrote in message
    news:...
    > Maybe it would help if you told us what the error actually is.
    >
    > Cheers
    > Ken
    >
    >
    > "Rich Cooper" <> wrote in message
    > news:%23cj%...
    > : hi, i have a small problme hopfeully there is a simple sollution. I

    have
    > a
    > : submit button on my page and when a user clicks on it i want them to be
    > able
    > : to change a value is the table doc_profile from Y to N. Here is what i
    > have
    > : so far but it gives me an error in my code. can you write sql code in
    > : vbscript fuctions?
    > :
    > : function btnundelete_OnClick
    > : dim oElement, oElements, oCkbox, oconn, rs, ssql, sconnstr
    > : dim bFound, sPIDList, i
    > : Cnt iCnt = 0
    > : bFound = false s
    > : ConnStr = session("ConnStr")
    > : Set oConn = Server.CreateObject("ADODB.Connection")
    > : oConn.Open sConnStr
    > : oConn.CursorLocation = 3
    > : oConn.CommandTimeout = 0
    > : set rs = Server.CreateObject("adodb.Recordset") rs.CursorLocation = 3
    > : set oElements = document.frmTL.elements
    > : for Each oElement in oElements
    > : if oElement.type= "checkbox" and oElement.checked = true then s
    > : PIDList = sPIDList & " '" & oElement.value & "',"
    > : iCnt = iCnt + 1
    > : end if
    > : next
    > : if len(sPIDList) > 0 then
    > : sPIDList = mid(sPidList, 1, len(sPidlist) - 1)
    > : end if
    > : if iCnt > 0 then
    > : msgbox(icnt)
    > : msgbox(spidlist)
    > : sSql = "update doc_profile set deleteflag = 'n' from doc_profile where

    pid
    > : =" & spid
    > : set rs = oConn.Execute(sSql)
    > : rs.Close
    > : else call msgbox ("Please make a selction before Undeleting a Doctor.",
    > : vbOKOnly + vbInformation, "Target List")
    > : end if
    > : end function
    > :
    > :
    > : Any help would be great
    > :
    > :
    >
    >
     
    Rich Cooper, Jun 29, 2004
    #3
  4. Rich Cooper

    Jeff Cochran Guest

    On Tue, 29 Jun 2004 09:51:22 -0400, "Rich Cooper"
    <> wrote:

    >the error is it won't chnage that value in my table from y to n. It says
    >error on page.


    How about the *exact* error message? In full.

    Jeff


    >"Ken Schaefer" <> wrote in message
    >news:...
    >> Maybe it would help if you told us what the error actually is.
    >>
    >> Cheers
    >> Ken
    >>
    >>
    >> "Rich Cooper" <> wrote in message
    >> news:%23cj%...
    >> : hi, i have a small problme hopfeully there is a simple sollution. I

    >have
    >> a
    >> : submit button on my page and when a user clicks on it i want them to be
    >> able
    >> : to change a value is the table doc_profile from Y to N. Here is what i
    >> have
    >> : so far but it gives me an error in my code. can you write sql code in
    >> : vbscript fuctions?
    >> :
    >> : function btnundelete_OnClick
    >> : dim oElement, oElements, oCkbox, oconn, rs, ssql, sconnstr
    >> : dim bFound, sPIDList, i
    >> : Cnt iCnt = 0
    >> : bFound = false s
    >> : ConnStr = session("ConnStr")
    >> : Set oConn = Server.CreateObject("ADODB.Connection")
    >> : oConn.Open sConnStr
    >> : oConn.CursorLocation = 3
    >> : oConn.CommandTimeout = 0
    >> : set rs = Server.CreateObject("adodb.Recordset") rs.CursorLocation = 3
    >> : set oElements = document.frmTL.elements
    >> : for Each oElement in oElements
    >> : if oElement.type= "checkbox" and oElement.checked = true then s
    >> : PIDList = sPIDList & " '" & oElement.value & "',"
    >> : iCnt = iCnt + 1
    >> : end if
    >> : next
    >> : if len(sPIDList) > 0 then
    >> : sPIDList = mid(sPidList, 1, len(sPidlist) - 1)
    >> : end if
    >> : if iCnt > 0 then
    >> : msgbox(icnt)
    >> : msgbox(spidlist)
    >> : sSql = "update doc_profile set deleteflag = 'n' from doc_profile where

    >pid
    >> : =" & spid
    >> : set rs = oConn.Execute(sSql)
    >> : rs.Close
    >> : else call msgbox ("Please make a selction before Undeleting a Doctor.",
    >> : vbOKOnly + vbInformation, "Target List")
    >> : end if
    >> : end function
    >> :
    >> :
    >> : Any help would be great
    >> :
    >> :
    >>
    >>

    >
     
    Jeff Cochran, Jun 29, 2004
    #4
  5. Rich Cooper

    Ken Schaefer Guest

    You mean in the Internet Explorer status bar? That's a client-side
    javascript/vbscript error. It means your client-side script is running into
    a problem. If this is classic ASP, you need to submit the form back to the
    server in order to have the ASP run - ASP only runs on the server (Active
    *Server* Pages).

    Cheers
    Ken

    "Rich Cooper" <> wrote in message
    news:...
    : the error is it won't chnage that value in my table from y to n. It says
    : error on page.
    : "Ken Schaefer" <> wrote in message
    : news:...
    : > Maybe it would help if you told us what the error actually is.
    : >
    : > Cheers
    : > Ken
    : >
    : >
    : > "Rich Cooper" <> wrote in message
    : > news:%23cj%...
    : > : hi, i have a small problme hopfeully there is a simple sollution. I
    : have
    : > a
    : > : submit button on my page and when a user clicks on it i want them to
    be
    : > able
    : > : to change a value is the table doc_profile from Y to N. Here is what
    i
    : > have
    : > : so far but it gives me an error in my code. can you write sql code in
    : > : vbscript fuctions?
    : > :
    : > : function btnundelete_OnClick
    : > : dim oElement, oElements, oCkbox, oconn, rs, ssql, sconnstr
    : > : dim bFound, sPIDList, i
    : > : Cnt iCnt = 0
    : > : bFound = false s
    : > : ConnStr = session("ConnStr")
    : > : Set oConn = Server.CreateObject("ADODB.Connection")
    : > : oConn.Open sConnStr
    : > : oConn.CursorLocation = 3
    : > : oConn.CommandTimeout = 0
    : > : set rs = Server.CreateObject("adodb.Recordset") rs.CursorLocation = 3
    : > : set oElements = document.frmTL.elements
    : > : for Each oElement in oElements
    : > : if oElement.type= "checkbox" and oElement.checked = true then s
    : > : PIDList = sPIDList & " '" & oElement.value & "',"
    : > : iCnt = iCnt + 1
    : > : end if
    : > : next
    : > : if len(sPIDList) > 0 then
    : > : sPIDList = mid(sPidList, 1, len(sPidlist) - 1)
    : > : end if
    : > : if iCnt > 0 then
    : > : msgbox(icnt)
    : > : msgbox(spidlist)
    : > : sSql = "update doc_profile set deleteflag = 'n' from doc_profile where
    : pid
    : > : =" & spid
    : > : set rs = oConn.Execute(sSql)
    : > : rs.Close
    : > : else call msgbox ("Please make a selction before Undeleting a
    Doctor.",
    : > : vbOKOnly + vbInformation, "Target List")
    : > : end if
    : > : end function
    : > :
    : > :
    : > : Any help would be great
    : > :
    : > :
    : >
    : >
    :
    :
     
    Ken Schaefer, Jun 30, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark
    Replies:
    1
    Views:
    1,728
  2. Ghafran Abbas
    Replies:
    0
    Views:
    4,249
    Ghafran Abbas
    Oct 12, 2004
  3. Replies:
    2
    Views:
    6,271
  4. Network-Man
    Replies:
    5
    Views:
    78,568
    gaul1
    Jul 7, 2012
  5. Guest
    Replies:
    2
    Views:
    1,617
    Guest
    Oct 25, 2004
Loading...

Share This Page