Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Button Action


Message #1 by Gui You <guiyou01@y...> on Tue, 21 Jan 2003 11:17:58 -0800 (PST)
Dear all experts,

I am writing a asp script that allow people to update, delete info from 
web input box. I need to help for button updating and deleting. Thanks 
guys.

<form action="savethispage" method=post>

<input type=button name=ActionName value=Update>

<input type=button name=ActionName value=Delete>

<input type=text name=A value=>

<input type=text name=B value=>

.....Connectivity here....

If Request.Form("ActionName") = "Update" Then

  RecordSet("A") = Request.Form("A")

  RecordSet("B") = Request.Form("B")

  RecordSet.Update

End If

= = = = = = = = = = = = = 

But if the button has been clicked, nothing to happen. Please help me. 

YoYo

 



---------------------------------
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now
Message #2 by Mark Eckeard <meckeard2000@y...> on Tue, 21 Jan 2003 11:25:47 -0800 (PST)
That's because you don't have any of the buttons types
set as "submit".  Like this:

<input type=submit name=ActionName value=Update>

--- Gui You <guiyou01@y...> wrote:
> Dear all experts,
> 
> I am writing a asp script that allow people to
> update, delete info from 
> web input box. I need to help for button updating
> and deleting. Thanks 
> guys.
> 
> <form action="savethispage" method=post>
> 
> <input type=button name=ActionName value=Update>
> 
> <input type=button name=ActionName value=Delete>
> 
> <input type=text name=A value=>
> 
> <input type=text name=B value=>
> 
> .....Connectivity here....
> 
> If Request.Form("ActionName") = "Update" Then
> 
>   RecordSet("A") = Request.Form("A")
> 
>   RecordSet("B") = Request.Form("B")
> 
>   RecordSet.Update
> 
> End If
> 
> = = = = = = = = = = = = = 
> 
> But if the button has been clicked, nothing to
> happen. Please help me. 
> 
> YoYo
> 
>  
> 
> 
> 
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
Message #3 by "Peter Foti (PeterF)" <PeterF@S...> on Tue, 21 Jan 2003 14:50:06 -0500
You need to define an action for the button onclick event.  Something like:

onclick="document.forms[0].submit();"

(or something to that effect... I'm a little out of practice). :)

Regards,
Peter Foti


> -----Original Message-----
> From: Gui You [mailto:guiyou01@y...]
> Sent: Tuesday, January 21, 2003 2:18 PM
> To: ASP Databases
> Subject: [asp_databases] Button Action
> 
> 
> Dear all experts,
> 
> I am writing a asp script that allow people to update, delete 
> info from 
> web input box. I need to help for button updating and 
> deleting. Thanks 
> guys.
> 
> <form action="savethispage" method=post>
> 
> <input type=button name=ActionName value=Update>
> 
> <input type=button name=ActionName value=Delete>
> 
> <input type=text name=A value=>
> 
> <input type=text name=B value=>
> 
> .....Connectivity here....
> 
> If Request.Form("ActionName") = "Update" Then
> 
>   RecordSet("A") = Request.Form("A")
> 
>   RecordSet("B") = Request.Form("B")
> 
>   RecordSet.Update
> 
> End If
> 
> = = = = = = = = = = = = = 
> 
> But if the button has been clicked, nothing to happen. Please 
> help me. 
> 
> YoYo
> 
>  
> 
> 
> 
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now
> 
> 
Message #4 by "YoYo" <guiyou01@y...> on Tue, 21 Jan 2003 21:20:39
Thank you for your help. 

Actually, I have a input box(editable) that gets data from a ACCESS DB, 
and I need to do an update for the existing record. So I put a button - I 
changed to Submit button for clicking. But it still does nothing. Please 
help me again. Thanks a lot. - YOYO
= = = = = = = = = = = = = = = = = = = = = = = 
<form name= action=samethispage method=post>
  .
  .
  .
<input type=""submit"" name=""ActionID"" value=""Update"">
  .
  .
  .

If Request.Form("ActionID") = "Update" Then
  Response.Write "I am doing an updating action..." & "<br>"
  Response.Write "This SeqNum is = " & GetThisSeq & "<br>"

 On Error Resume Next
   strConnect = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & 
Request.ServerVariables("APPL_PHYSICAL_PATH") & wwwdirhack & DOHCoverageDB
   debugdisp "updating record Seq=[" & GetThisSeq & "]"

  SqlQuery = "SELECT * FROM [" & DOHCoverageOutOfOfficeTable & "]"
  SqlQuery = SqlQuery & "WHERE Occurrance = " & GetThisSeq
  debugdisp "objConn= " & objConn
  debugdisp "SqlQuery= " & SqlQuery
  Set objConn = Server.CreateObject("ADODB.Connection")
  objConn.Open strConnect

  application.lock
  Set objRS = Server.CreateObject("ADODB.Recordset")
  objRS.Open SqlQuery, objConn

  objRS.Fields("StartDate") = Request.Form("UpdatedStartDate")
  objRS.Fields("EndDate") = Request.Form("UpdatedEndDate")
  objRS.Fields("Comments") = Request.Form("UpdatedComments")
  objRS.Update

  UpdateStatus = "True"
  If UpdateStatus = "True" Then
   Response.Write "Your record has been updated."
  End If

  If (err.number <> 0) Then
   debugdisp "Update user error: " & err.number & vbcrlf & "" & 
err.description
   'JSAlertWindow "PopUp3", "Error updating user!" & vbcrlf & "Error:" 
& "err.num & vbcrlf & err.description
  End If

 Application.Unlock
 objRS.Close
 objConn.Close
 Set objRS = Nothing
 Set objConn = Nothing
On Error GoTo 0
End If

 Response.Write "</form></table>"

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 


  Return to Index