473,503 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Self Submit - lost values

4 New Member
I have one text fields(A) and two Select/Option within a self posting form.
When form comes back the text field is=null, and selects=null, I have lost values.
Question - how do I preserve or repopulate the text fields and select?


<FORM METHOD="POST" NAME="form1" ACTION="">
<input type="text" name="A" >
<p>
<select name="B" >
<option value ="">Select B</option>
<option value ="10">10</option>
</select>
<p>
<select name="search" onchange=form1.submit() >
<option value ="">Select Miles</option>
<option value ="10">10</option>
</SELECT>
</FORM>
Mar 19 '08 #1
5 2628
DrBunchman
979 Recognized Expert Contributor
Hi adragton,

To populate your fields with the form variables you need to set their values. Like this:
Expand|Select|Wrap|Line Numbers
  1.  
  2. <input type="text" name="A" value="<%=Request.Form("A")%>" />
  3.  
You can do the same with your drop downs by comparing their value with the request.form variable. Like so:
Expand|Select|Wrap|Line Numbers
  1. <select name="B" >
  2. <option value ="">Select B</option>
  3. <option value ="10" <%If Request.Form("B") = "10" Then "Selected" End If%>>10</option>
  4. </select>
  5.  
I hope this helps.

Dr B
Mar 19 '08 #2
adragton
4 New Member
Excellent DrBunchman

your example works!!!

Now to increase the situation.
add an addition form on the same page self submitting like before.

How to capture Form1 AND Form2 variables after Form2 submits??

<FORM METHOD="POST" NAME="form1" ACTION="">
<input type="text" name="A" >
<p>
<select name="B" >
<option value ="">Select B</option>
<option value ="10">10</option>
</select>
<p>
<select name="search" onchange=form1.submit() >
<option value ="">Select Miles</option>
<option value ="10">10</option>
</SELECT>
</FORM>
<p>
<FORM METHOD="POST" NAME="form2" ACTION="">
<input type="text" name="B" >
</FORM>
Mar 19 '08 #3
DrBunchman
979 Recognized Expert Contributor
Why not just have one form on the page and put all your controls inside it? Then you can access all the form variables when it submits?

Dr B
Mar 20 '08 #4
adragton
4 New Member
Because later I am going to have multiple dropdowns LINKED, and that is going to require MULTIPLE forms on same page.
Mar 21 '08 #5
DrBunchman
979 Recognized Expert Contributor
I don't know if that's possible - normally you can only retreive form data that was contained in the form that was submitted. Whether it's do-able with javascript - perhaps capturing all the control values at the time of submitting and passing them as hidden data? - I don't know.

Any other experts got any ideas?

Good luck finding a solution,

Dr B
Mar 25 '08 #6

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

Similar topics

1
3124
by: Danny Anderson | last post by:
Hola, PHP folk! I have a php page that contains a self-processing form. The form holds search results. The search terms originally came from the previous page, but the user can repeatedly...
2
4694
by: Marc | last post by:
Hi all, I was using Tkinter.IntVar() to store values from a large list of parts that I pulled from a list. This is the code to initialize the instances: def initVariables(self): self.e =...
6
4021
by: Joop | last post by:
Hi all, I'm kinda new to JavaScript, but hey... I'm trying anyway! ;-) So, here's my problem : I've created a table in my document, presenting a list of items, one can 'select' by clicking...
1
2254
by: ed_spain | last post by:
Hi Everyone, On an HTML page with 2x different forms, how can I redisplay the same page after a submit, restoring the values from BOTH forms even though only one was submitted? I have an...
1
1714
by: Andy Kasotia | last post by:
I have an ASP UI with VB Dll as a COM object that access the DB2 Database. I have a "Calculate" button on the ASP Page which when clicked does form validation (javascript) and submits the form...
1
1714
by: Daniel Goldman | last post by:
I have a C program that analyzes data. It makes tables, graphs, other output in response to user selections. It normally takes keyboard input into a curses-based user interface. However, it can...
0
1160
by: Corinne | last post by:
Hi All, I have created a form. with radiobuttonlist. On submit the form calls itself as it reloads I want the radiobuttonlist to be displayed but i don't want anyone to be able to change the...
2
2055
by: John Murtari | last post by:
Folks, We are working on upgrading a web based application that allows the user to type quite a long essay and then submit it to the web site for processing. Occasionally, the user will lose...
3
4385
by: ccyarm | last post by:
Hello, I need to modify the following code to make it work with Firefox. It works perfectly well with IE. It seems to me that with Firefox all the form values are lost when the onUnload fires up. ...
0
7072
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...
0
7271
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,...
0
7319
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...
1
6979
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...
0
7449
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...
1
4998
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...
0
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1498
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 ...
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.