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.
7 2276 acoder 16,027
Recognized Expert Moderator MVP
Post the code you have tried so far.
-
-
-
-
function form_setdata()
-
{
-
-
try{
-
var count=0,count1=0;
-
var value;
-
var date1,titleid1,newbug1,repeatedbug1,targetfw1,testerid1,basefw1,report1;
-
-
Recordset2 = Connection1.Execute("select * from sampleTable;");
-
Recordset2.MovePrevious();
-
document.getElementById("Date").value=Recordset2.fields("Date");
-
document.getElementById("lang_id").value=Recordset2.fields("LangID");
-
document.getElementById("LangName").value=Recordset2.fields("LangName");
-
document.getElementById("ver").value=Recordset2.fields("Ver");
-
document.ip_form.updt_btn.disabled=false;
-
-
-
}catch(ex)
-
{
-
alert("ERROR in form_setdata()" + ex.message);
-
}
-
}
-
- </head>
-
-
<body>
-
-
-
// ASP Code
-
<%
-
dim TT_Date,LangID,Language,Version,Button_value
-
Dim Connection
-
Dim Recordset
-
Dim selecteditem
-
-
Set Connection = Server.CreateObject("ADODB.Connection")
-
Set Recordset = Server.CreateObject("ADODB.Recordset")
-
Connection.Open "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;PORT=3306;DATABASE=sample;USER=root;PASSWORD=pass;OPTION=3;"
-
Recordset.ActiveConnection = Connection
-
Recordset.CursorType ="2"
-
-
TT_Date= request.Querystring("Date")
-
LangID =request.Querystring("lang_id")
-
Language =request.Querystring("LangName")
-
Version = request.Querystring("ver")
-
Button_value = request.Querystring("Submit_button")
-
-
if(Button_value="Next") then
-
selecteditem=1
-
elseif(Button_value="Submit")then
-
selecteditem=2
-
-
end if
-
Select Case selecteditem
-
Case 1
-
-
Connection.Execute("INSERT INTO sampleTable VALUES ('" +Date+ "','" +lang_id+ "','" +LangName+ "','" +ver+ "' );")
-
Case 2
-
Connection.Execute(""INSERT INTO sampleTable VALUES ('" +Date+ "','" +lang_id+ "','" +LangName+ "','" +ver+ "' );")
-
%>
-
<script type="text/javascript">
-
alert("Data submitted succesfully");
-
</script>
-
<%
-
response.redirect "Form1.asp"
-
End Select
-
%>
-
-
-
-
// Form Data
-
<input name="Date_Lang" id="Date" maxlength="25" size="25" type="text">
-
<input name="title_id" id="lang_id" maxlength="25" size="25" type="text"></td>
-
<input name="title_id" id="LangName" maxlength="25" size="25" type="text"></td>
-
<input name="title_id" id="ver" maxlength="25" size="25" type="text"></td>
-
-
-
-
-
<td> <input value="Next" type="submit" name="Submit_button"></td>
-
-
<td> <input value="Back" type="Button" name="Back_button" onclick="form_setdata()"></td>
-
-
<td> <input value="Submit" type="submit" name="Submit_button" ></td>
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.
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.
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.
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..
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
by: Andre |
last post by:
Hi,
This is 'test.htm'
---------------
<form name=totd>
<input name="ud" type="hidden" value="" >
</form>
|
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...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
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...
|
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...
| |
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. ...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |