473,698 Members | 2,503 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Update values without Page Refresh

6 New Member
Hi,

I'm very much a novice, and wondered if someone could help. I'll try to be as specific as possible, but don't waant you to have to read too much.

I have 2 pages in the sequence. 1st allows customers to login, passing control to the 2nd, which on entry returns their balance details from my DB (using their Reference 'BookingRef = Request.form("t xtBookingRef")' ) and displays an additional section allowing them to enter an amount of a part payment, which supsequently passes them to my PayPal account (Form2).

The main purpose is that on the 2nd page, a value is entered, the update button clicked, other values on the page are updated, i.e.
Enter Amount (Input field)
- update button -
'Amount Entered' asp calculated field
'CC Charge' asp calculated field
'Total Amount' asp calculated field
I have both pages working ok (individually, i.e. hardcoding the BookingRef on the 2nd page), but when I pass it from page 1 and when I click the update button after entering a value, the complete page is refreshed, and the Reference is lost, with the page returning the following error 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1' + referring to the line number of my 'rs.Open sqlStr, conn'.

1. I would prefer to keep it in asp. Is there any way I can retain my BookingRef passed from page 1 when I update the other values?

2. I have changed Page2 & tried javascript, using onChange, which works ok, but I can't work out how to get the 'Total Amount' value to my Hidden PayPal form also ( I can get it to the 'Total Amount' ok - as it is in the same form)

I would really appreciate any suggestions for #1

If #1 is not possible, can you help with #2

thanks, Michael

PS - I should have mentioned, that I am NOT posting the amount entered back to the DB - I do that manually myself via different pages, as I need to allocate it differently.
Oct 26 '07 #1
8 4515
jhardman
3,406 Recognized Expert Specialist
1- To keep data with a user through multiple pages, I prefer to use session-level variables
Expand|Select|Wrap|Line Numbers
  1. if request.form("txtBookingRef") <> "" then
  2.    session("BookingRef") = Request.form("txtBookingRef")
  3. end if
this can then be accessed on every page the user visits.

2- This is kind of a javascript issue. I'm not an expert in javascript but I could probably get it to work. I would need to see your code though.

Let me know if this helps.

Jared
Oct 28 '07 #2
m1post
6 New Member
Thanks Jared,
I'll stick with the asp option if I can get it to work.
Here's the code I'm using to get the details back from the DB
----------------
BookingRef = Request.form("t xtBookingRef")
sqlStr = " SELECT td.task_detail_ id_int"
sqlStr = sqlStr & " FROM task_detail td"
sqlStr = sqlStr & " JOIN booking b ON td.booking_id_i nt = b.booking_id_in t"
sqlStr = sqlStr & " WHERE status_id_int = 1 and b.booking_ref_v ch = " + cstr(BookingRef )

conn.Open
rs.Open sqlStr, conn
TaskID = rs("task_detail _id_int")
conn.Close
---------------
I then use the TaskID to pull back all the client, payment, Booking Status, etc. from an include file.

where should I insert the session-level code?

Thanks again, Michael
Oct 30 '07 #3
markrawlingson
346 Recognized Expert Contributor
If BookingRef is what you want to be able to access from any page, then you would insert it like so...

Expand|Select|Wrap|Line Numbers
  1. Session("BookingRef") = Request.form("txtBookingRef")
  2. sqlStr = " SELECT td.task_detail_id_int"
  3. sqlStr = sqlStr & " FROM task_detail td"
  4. sqlStr = sqlStr & " JOIN booking b ON td.booking_id_int = b.booking_id_int"
  5. sqlStr = sqlStr & " WHERE status_id_int = 1 and b.booking_ref_vch = " + cstr(Session("BookingRef"))
  6.  
  7. conn.Open 
  8. rs.Open sqlStr, conn
  9. TaskID = rs("task_detail_id_int")
  10. conn.Close
  11.  
Instead of storing the information from Request.Form("t xtBookingRef") in a variable which can only be used within this script, you set it into a Session variable named Session("Bookin gRef") which is stored in the server's memory, and thus can be accessed again on any page simply by referring to it...

Expand|Select|Wrap|Line Numbers
  1. Response.Write "Your bookingref = " & Session("BookingRef")
  2.  
Oct 31 '07 #4
m1post
6 New Member
Thanks Mark.

I've tried all variations, but still can't get it to hold the BookingRef in the session.
Error message below - I'm using a MySQL DB, so not sure if that makes any difference?
---------------------------------------
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[MySQL][ODBC 3.51 Driver][mysqld-5.0.27-standard-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''
------------------------------------
I only get this error message when I attempt to update the details on the page. When I load it first, I can get all details back from the DB ok.

hope you can help.

thanks, Michael
Oct 31 '07 #5
m1post
6 New Member
It's the update <form> that seems to be causing the problem.
If I just referesh the page - fine.
If I click the Update button (within the <form>) I get the above error, so I am loosing the "BookingRef " at that stage.

(the update <form> takes the Payment Amount Entered, updates/displays the Payment Amount Entered (to a seperate field), Updates/displays the Credit Card Charge & the Total Amount to be charged.

But the <form> does not actually use/hold the BookingRef.

Thanks, Michael
Nov 1 '07 #6
markrawlingson
346 Recognized Expert Contributor
Hi Michael,

Show the update statement.
Nov 1 '07 #7
m1post
6 New Member
Hi Chris,

I've stripped all the other details out, except the Update <form>. which works ok in itself, but I get the above error when I try the update with all the other details, i.e. the BookingRef, etc from the previous page & DB.

Thanks, Michael

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.     <head>
  3.     <script language="javascript">            
  4.             function ValidateForm()
  5.             {
  6.                 var rtnStr = "";
  7.                 var vCtrl = "";
  8.  
  9.             if(document.frmUpdatePartPayform.AmountEntered.value == "")
  10.                 {
  11.                     rtnStr = rtnStr + " - Please enter Payment Amount.\n"
  12.                     if (vCtrl == "")
  13.                     {
  14.                         vCtrl = "AmountEntered";
  15.                     }
  16.                 }
  17.  
  18.             if ((document.frmUpdatePartPayform.AmountEntered.value.length > 0) && (isNaN(document.frmUpdatePartPayform.AmountEntered.value*(-1)*(-1))))
  19.                 {
  20.                     rtnStr = rtnStr + " - Please enter a numeric Payment Value.\n"
  21.                     if (vCtrl == "")
  22.                     {
  23.                         vCtrl = "AmountEntered";
  24.                     }
  25.                 }
  26.             if (rtnStr != "")
  27.                 {
  28.                     alert(rtnStr)
  29.                     document.getElementById(vCtrl).focus()
  30.                     return false;        
  31.                 }
  32.                 else
  33.                 {
  34.                     return true;
  35.                 }
  36.             }    
  37. </script>
  38. <%
  39. cc_percent_charge = 0.035
  40. AmountEntered = Request.Form("AmountEntered")
  41.  
  42.     If AmountEntered = "" then CC_Charge = FormatNumber((0),2)
  43.     If AmountEntered = "" then Display_CC_Charge = FormatNumber((0),2)
  44.     If AmountEntered = "" then Display_AmountEntered = FormatNumber((0),2)
  45.     If AmountEntered <> "" then CC_Charge = (AmountEntered * cc_percent_charge)
  46.     If AmountEntered <> "" then Display_CC_Charge = FormatNumber((CC_Charge),2)
  47.     If AmountEntered <> "" then Display_AmountEntered = FormatNumber((AmountEntered),2)
  48.  
  49.     TotalToPay = (AmountEntered + CC_Charge)
  50.     Display_TotalToPay = FormatNumber((TotalToPay),2)
  51. %>
  52.         <table>    
  53.         <form name="frmUpdatePartPayform" method="post"  onsubmit="return ValidateForm();" ID="Form1">
  54.             <tr>
  55.                 <td NOWRAP>
  56.                     Enter the Payment Amount
  57.                 </td>
  58.                 <td >
  59.                     <input size="4" name="AmountEntered">
  60.                 </td>
  61.             </tr>
  62.             <tr >
  63.                 <td NOWRAP >
  64.                     <input valign="middle" class="button"  type="submit" value="Click Here To Update">
  65.                 </td>
  66.             </tr>
  67.             <tr>
  68.                 <td NOWRAP >
  69.                     <b>Amount Entered</b>
  70.                 </td>
  71.                 <td>
  72.                     <b><%=Display_AmountEntered%></b>
  73.                 </td>
  74.             </tr>
  75.             <tr>
  76.                 <td NOWRAP>
  77.                     <b>Processing Charge </b>
  78.                 </td>
  79.                 <td >
  80.                     <%=Display_CC_Charge%>
  81.                 </td>
  82.             </tr>
  83.             <tr>
  84.                 <td NOWRAP>
  85.                     <b>Total to Pay on this Transaction</b>
  86.                 </td>
  87.                 <td >
  88.                     <b><%=Display_TotalToPay%></b>
  89.                 </td>
  90.             </tr>
  91.         </form>    
  92.         </table>
  93.     </body>
  94. </html>
  95.  
  96.  
Nov 2 '07 #8
m1post
6 New Member
Sorry Mark,

I realised I hadn't included the 2nd <form> that is (needed to be) updated to go out to my PayPal account

Thanks, Michael

Expand|Select|Wrap|Line Numbers
  1. <form action="https://www.paypal.com/cgi-bin/webscr" method="post" ID="Form2">
  2.     <input type="hidden" name="amount" value="<%=Display_TotalToPay%>" ID="Hidden16">
  3.     <input class="button" type="submit" name="submit" value="Proceed to Payment" ID="Submit2">
  4. </form>    
  5.  
  6.  
Nov 6 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

3
4929
by: Kevin Pedersen | last post by:
Hello, I am using an editable datagrid. After I save the changes the datagrid shows the old values. I've read the posts about the Page_Load and not binding the datagrid each time. The SQL that is being sent to the database is correct and the changes are eventually being made. If I refresh the page after the update then the new values appear. I noticed that when I put a breakpoint in my update handler everything works fine. When I take...
9
1817
by: Chris | last post by:
I pop up a Modal form on a web page that allows the user to update the selections of a dropdownlist via adding a new item to the db (Sql Server).The only thing is this list is on the page beneath it. So when the user updates the db with a new selection, and then closes the form, the page below must be refreshed to see the new option. Any ideas on adding the new option to the control below the modal form? thanx.
1
9217
by: nospamjac | last post by:
Hi, Is there a way to update the text of an asp:label on a webform without refreshing the entire page? What is called by button clicks and other events that refresh a webform control? See the example WebForm1.aspx and WebForm1.aspx.cs code below: WebForm1.aspx =======================================================
1
7485
by: cguillot | last post by:
Hello, I have a web page that displays information from a SQL database and this information can change frequently. Basically, a database entry is made into a table every time a person enters or leaves a defined area and I need to display this information to a user watching a monitor. Automatically refreshing the page is not a good option because it would have to refresh no more than every 5 seconds and the screen flashes are annoying. ...
4
3406
by: Jim Hammond | last post by:
It would be udeful to be able to get the current on-screen values from a FormView that is databound to an ObjectDataSource by using a callback instead of a postback. For example: public void RaiseCallbackEvent(string eventArgs) { // update the data object with the values currently on screen FormView1.UpdateItem(true); }
8
2694
by: Zorpiedoman | last post by:
I keep getting a concurrency exception the second time I make a change and attempt to update a dataadapter. It appears this is by design, so there must be something I can do to avoid it. Example: I have a dataadapter that contains one table with one row. I change the value of the 'FisrtName' column in that row from Jack to John. I call ..update on the dataadapter it goes through fine. Now I change that same column in that same row...
0
2206
by: Metal2You | last post by:
I'm working on an ASP.NET 2.0 application in Visual Studio 2005 that accesses a Sybase database back end. We're using Sybase SQL Anywhere 9.0.2.3228. I have installed and registered the Sybase .NET 2.0 DataProvider (iAnywhere.Data.AsaClient.dll) into the GAC so it can be used in the ProviderName property of a SQLDataSource and loads properly at run time. The application I'm writing is a bit more complex than the example I'm about to...
3
5300
by: laryten | last post by:
Hi, Is there a way to update the same web page instead of getting a new page each time we click the submit button? The simplest thing to do is to delete the current page (or go back to the previous page) and then redraw the page. There are a few possible solutions: 1. Use the same URL again. But a new page will still be created. 2. Use the "onsubmit" option:
5
6954
by: handoyo | last post by:
Hi all,i'm trying to show updated data in existing html td.. For example i got column that show last modified datetime,then i want to update data again,the column will changed to current time without refreshing the page.These are my codes views/order_home <script type="text/javascript" src="<?php echo base_url(); ?>js/jquery.js"></script> <script type="text/javascript" src="<?php echo base_url(); ?>js/jquery.form.js"></script> <script...
0
8680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9169
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9030
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7738
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.