displaying a pop-up message

Results 1 to 2 of 2

Thread: displaying a pop-up message

  1. #1
    Join Date
    Dec 1969

    Default displaying a pop-up message

    I know how to create pop-up messages through javascript saying if x=y alert("wrong value.") So, I&#039;ve got that down. Here&#039;s the problem. I have a form that allows users to enter contact information into a database. When the user clicks Add, the page checks to make sure that company doesn&#039;t already exist in the database. If it does, it displays a pop-up message stating that company already exists in the database. It it doesn&#039;t, it adds the company to the database and displays a message saying that the record was successfully added.<BR><BR>It all works fine except I only know how to display pop-up messages through Javascript and the rest of the code is in VBScript. So I&#039;ve ended up mixing the two types of code, but its not working very well. Any suggestions? Here&#039;s my code.<BR><BR>&#060;%<BR>&#039;when the user clicks Add, insert the company information to the database<BR><BR>if NOT isempty (Request.Form("Add")) then<BR><BR>Set conn = Server.CreateObject("ADODB.Connection")<BR>conn.Op en "DSN=intranet"<BR><BR>&#039;check and see if that company name already exists in the database<BR>set rs = conn.Execute("SELECT Company_Name FROM Companies WHERE Company_Name = &#039;" & Request.Form("txtCompanyName") & "&#039;")<BR><BR>&#039;if it doesn&#039;t already exist, open the Companies table and add a new record. <BR>if rs.EOF then<BR>Set rs1 = Server.CreateObject("ADODB.RecordSet")<BR><BR>rs1. Open "Companies", conn, adOpenKeySet, adLockOptimistic, adCmdTable<BR>rs1.AddNew<BR>rs1("Company_Name") = CompanyName<BR>rs1("Company_Phone") = Phone<BR>rs1("Company_Website") = URL<BR>rs1("Company_Notes") = Notes<BR>rs1.Update<BR>idOfAddedRecord = rs1("Company_ID")<BR><BR>rs1.Close<BR>set rs1=nothing<BR><BR>&#039; display a message stating that the record was successfully added <BR>%&#062;<BR>&#060;script&#062;<BR>alert("Reco rd successfully added.")<BR>&#060;/script&#062;<BR><BR>&#060;%<BR>Response.Redirect "view_company.asp?CompanyID=" & idOfAddedRecord<BR><BR>&#039;if the company name already exists, display a message stating that the record already exists<BR>else %&#062;<BR>&#060;Script&#062;<BR>alert("Record already exists")<BR>&#060;/script&#062;<BR>&#060;%<BR>end if <BR>end if<BR>%&#062;<BR><BR>How can I call a Javascript function from within VBScript that will display the appropriate message?<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default Read this ...

    http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=121<BR><BR>And if you still don&#039;t get it, then ask again. Hokay?<BR><BR>

Posting Permissions

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