Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retaining textbox values on screen 1

Status
Not open for further replies.

newprogrammer999

Programmer
Aug 28, 2002
26
IE
Hi all,
I have an asp page that has the following structure:

<html>
form action = &quot;&quot;
some html code to draw textboxes and a button &quot;create&quot;
<% if action = &quot;create&quot;
....
make new button &quot;DoThis&quot;
elseif action = &quot;DoThis&quot;
do some actions
end if
%>

My problenm is that when i fill in the textboxes and then press the create button the values in the textboxes become blank. I have tried using sesion valiables to assign values to the textboxes but it just draws new textboxes whith the values inside them. A friend also suguested something like:
If(&quot;Page.IsPostBack&quot;) Then
but I think this is only a .net feature??

Basically my problem is that i want to do some action on the page and keep the current values in the textboxes. It seems simple but I still can't manage it! Any help on this would be much appreciated.

Regards,
benny
 
If you are trying to create more form objects then use client-side javascript and the DOM. Otherwise you need to write servers-side code to repopulate them or client-side cookies to hold and repopulate them. EIther way, it's tedious.

What are you creating?

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
At the moment I have a form for the user to fill in with textboxes. There are 2 action buttons on the form and at the moment when the first one is pressed all the values the user has filled in go blank although they are still required. I have tried assign the values in the textboxes to session variables i.e.
Session(&quot;textValue&quot;) = Request(&quot;textbox1)

and later in the code
textbox1.vaule = Session(&quot;textValue&quot;)

but this just draws a second textbox called textbox1
 
I'm still not sure what you are trying to do on the page. What do the action buttons do? can you post your code?

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Heres the guts of it - its pretty long over all but this should show what I am doing a bit better.

<%@ Language=VBScript %>
<%Response.Buffer=True%>

<title>Create Formulation</title>
</head>
<body>
<h1 align=&quot;center&quot;>Create Formulation</h1>
<Form method=&quot;post&quot; action=&quot;&quot;>
 
 
 
<table border=&quot;0&quot; cellpadding=&quot;10&quot;>
<tr>
<td>Formulation name:</td>
<td><input type=&quot;text&quot; name=&quot;formulationname&quot;></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<input type=&quot;submit&quot; name=&quot;action&quot; value = &quot;Select&quot;></td>

<%
if request(&quot;action&quot;)=&quot;Select FeedStuff&quot; then
Do some actions and
Response.Write (&quot;<input type=&quot;&quot;submit&quot;&quot; name=&quot;&quot;action&quot;&quot; value=&quot;&quot;Calculate&quot;&quot;>&quot;)
else if request(&quot;action&quot;)=&quot;Calculate&quot; Then
do some other actions
end if
%>
</html>



When the Select button is pressed then the value that has been entered in formulationname goes blank. All I want to be able to do is enter a value in to formulationname at the start and the value to remain there when the select button is pressed.

Thanks for the help,
benny
 
Is this what you need?

<td><input type=&quot;text&quot; name=&quot;formulationname&quot; value=&quot;<%=request(&quot;formulationname&quot;)%>&quot;></td>

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Thanks, ur a legend!

I knew it was only something simple.

Thanks again,

benny
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top