473,513 Members | 3,895 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Back button option to display the previously entered values

27 New Member
Hi ,
I am creating a web page, In that page we have a 3 buttons . one for prev,next and submit. I done the next and submit part.

Now my job is to write for Prev button. When i press prev button it should display the previously entered values in the text box. I had done like when i press next button from the first page it will insert the details into the database.Now if i press prev button, Using recordset.previous()... i will move to the prev data and let it display in the form .... But it is not working.

Please give me an idea as for this prev button.
Sep 26 '07 #1
7 2276
acoder
16,027 Recognized Expert Moderator MVP
Post the code you have tried so far.
Sep 26 '07 #2
Sonasang
27 New Member
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3.  
  4. function form_setdata()
  5. {
  6.  
  7. try{
  8.     var count=0,count1=0;
  9.     var value;
  10.     var date1,titleid1,newbug1,repeatedbug1,targetfw1,testerid1,basefw1,report1;
  11.  
  12.         Recordset2 = Connection1.Execute("select * from sampleTable;");
  13.         Recordset2.MovePrevious();
  14.         document.getElementById("Date").value=Recordset2.fields("Date");
  15.         document.getElementById("lang_id").value=Recordset2.fields("LangID");
  16.         document.getElementById("LangName").value=Recordset2.fields("LangName");
  17.         document.getElementById("ver").value=Recordset2.fields("Ver");
  18.         document.ip_form.updt_btn.disabled=false;
  19.  
  20.  
  21.             }catch(ex)
  22.     {
  23.         alert("ERROR in form_setdata()" + ex.message);
  24.     }
  25. }
  26.  
Expand|Select|Wrap|Line Numbers
  1. </head>
  2.  
  3. <body>
  4.  
  5.  
  6. //  ASP Code
  7. <%
  8. dim TT_Date,LangID,Language,Version,Button_value 
  9. Dim Connection
  10. Dim Recordset
  11. Dim selecteditem
  12.  
  13. Set Connection = Server.CreateObject("ADODB.Connection")
  14. Set Recordset = Server.CreateObject("ADODB.Recordset")
  15. Connection.Open "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;PORT=3306;DATABASE=sample;USER=root;PASSWORD=pass;OPTION=3;" 
  16. Recordset.ActiveConnection = Connection    
  17. Recordset.CursorType ="2"
  18.  
  19. TT_Date=    request.Querystring("Date")
  20. LangID =request.Querystring("lang_id")
  21. Language =request.Querystring("LangName")
  22. Version = request.Querystring("ver")
  23. Button_value = request.Querystring("Submit_button")
  24.  
  25.  if(Button_value="Next") then
  26.  selecteditem=1
  27.  elseif(Button_value="Submit")then
  28.  selecteditem=2
  29.  
  30.   end if
  31.   Select Case selecteditem
  32.         Case 1
  33.  
  34.             Connection.Execute("INSERT INTO sampleTable VALUES ('" +Date+ "','" +lang_id+ "','" +LangName+ "','" +ver+ "' );")
  35.         Case 2
  36.              Connection.Execute(""INSERT INTO sampleTable VALUES ('" +Date+ "','" +lang_id+ "','" +LangName+ "','" +ver+ "' );")
  37.             %>
  38.             <script type="text/javascript">
  39.             alert("Data submitted succesfully");
  40.             </script>
  41.             <%
  42.             response.redirect "Form1.asp"
  43. End Select
  44.  %>
  45.  
  46.  
  47.  
  48. // Form Data
  49. <input name="Date_Lang" id="Date" maxlength="25" size="25" type="text">
  50. <input name="title_id" id="lang_id" maxlength="25" size="25" type="text"></td>
  51. <input name="title_id" id="LangName" maxlength="25" size="25" type="text"></td>
  52. <input name="title_id" id="ver" maxlength="25" size="25" type="text"></td>
  53.  
  54.  
  55.  
  56.  
  57.    <td> <input value="Next" type="submit" name="Submit_button"></td>
  58.  
  59.   <td> <input value="Back" type="Button" name="Back_button"  onclick="form_setdata()"></td>
  60.  
  61.  <td>     <input value="Submit" type="submit" name="Submit_button" ></td>
Oct 2 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
On lines 9-14, you have code which looks like ASP code. Javascript can't connect and execute statements like that. Use Ajax instead. You make a request to a server-side script which will retrieve the previous values for you.
Oct 2 '07 #4
Sonasang
27 New Member
On lines 9-14, you have code which looks like ASP code. Javascript can't connect and execute statements like that. Use Ajax instead. You make a request to a server-side script which will retrieve the previous values for you.

Hi Acoder,

Actually i am using ASP and Javascript. The lines from 9 -15 is actually ASP.Here when i call the function form_setdata(), I am moving my recordset to the the last entered value and then getting the values and displaying the same in the form.
I don know AJAX. I have tried the simple logic but it is not working.

Pls help me reg this.
Oct 2 '07 #5
acoder
16,027 Recognized Expert Moderator MVP
Actually i am using ASP and Javascript. The lines from 9 -15 is actually ASP.Here when i call the function form_setdata(), I am moving my recordset to the the last entered value and then getting the values and displaying the same in the form.
I don know AJAX. I have tried the simple logic but it is not working.
Once the page has loaded, you can't call a function that will run ASP like that. The ASP code will run while the page is loading.

See the AJAX tutorial links in the Offsite Links thread. Also, check out a simple AJAX example.
Oct 2 '07 #6
Sonasang
27 New Member
Once the page has loaded, you can't call a function that will run ASP like that. The ASP code will run while the page is loading.

See the AJAX tutorial links in the Offsite Links thread. Also, check out a simple AJAX example.

Hi Acoder,
There is no problem in Next and submit button. I have written the code for both Next and Submit in ASP which is working fine. I have included the code for Back buton where i am just calling a function for Onclick event. Where it will just get the values from the server and display in the form.


Thanks for the link of the AJAX and it is interesting to learn..
Oct 3 '07 #7
acoder
16,027 Recognized Expert Moderator MVP
There is no problem in Next and submit button. I have written the code for both Next and Submit in ASP which is working fine.
The reason why the next and submit buttons work is that when clicked, the form is submitted to the ASP page while the back button stays within the page and tries to call ASP code. Either use AJAX to call the ASP code or just make the back button into a submit button too and check the value as you have done for Next and Submit.
Oct 3 '07 #8

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

Similar topics

3
2984
by: Ray Torres | last post by:
I would appreciate any help with the following problem. I have several different htm pages with (simalar) forms that are processed by the same PHP script. If there is data missing on the form, the script displays an error page (using the header() function) and informs the user to press the browser's "Back" button. The problem is that...
4
1496
by: Andre | last post by:
Hi, This is 'test.htm' --------------- <form name=totd> <input name="ud" type="hidden" value="" > </form>
3
2394
by: Penny Bond | last post by:
Hi, Any help or suggestions on this one would be gratefully appreciated: I have 2 aspx pages one is called 'Query' and the other 'Details'. Query page has a number of text boxes and drop down's for parameter selection, a 'Search' button and a grid that displays the results (the results contain links to 'Details' page with query string...
6
2537
by: Nad | last post by:
Hello, In order to go back to the previous page from a page with possible postbacks I keep Request.Referrer in ViewState and then use it to redirect to the previous page. However I am losing all the information entered in the previous page. I also want to keep the entries in many fields/controls in the previous page. Is there a way to...
3
1322
by: The One | last post by:
Have created a form to pop up with 2 option I then wish to write the text that is in the option button chose back to the original form using the code below but it gives me an exception error so could any please help me. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim frm As...
1
4495
by: Stephen D Cook | last post by:
In my form I have an option group with 3 option buttons. My form is tied to a table. the options are Temp, Permanent and Overtime. I have these inside a frame. I have an AddRecord button to enter the data into the table. After the record is Added the option buttons are emptied. I want to require the person to click one of the option...
13
2401
by: alive84 | last post by:
Hi there, I have a two problems concerning option button values on a report and data report creator reports. The situation: I have three option value boxes two have 3 option and one has only two option buttons. They have values 1, 2, 3. Everything is standard. Now when I create the report, I have only the number for each record on the...
1
3959
by: CoolRajan | last post by:
Hi friends, I have four form pages in my application and all the pages contain different fields for entering values in that. In my first page I have one Continue button and on submitting it redirects to second page. In the second page I have two buttons namely Back and Continue. After entering values in the second form page if I click the Back...
12
8077
by: jim.richardson | last post by:
Hi all, I'd like a page to be excluded from the back button history, that is, when a user hits their browser's back button, it never backs into this particular page. Can anybody please tell me how to do this? I thought perhaps there would be some kind of special meta tag that says something like "exclude me from browser's history", but...
0
7270
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...
0
7178
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...
0
7397
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. ...
1
7125
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...
0
7543
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5102
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...
0
3239
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1612
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
0
470
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...

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.