473,594 Members | 2,768 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

keep the values when it redirect the same page

3 New Member
Hi,

I have a question.

I made the create the new user form.

Expand|Select|Wrap|Line Numbers
  1.  <script language="javascript"> 
  2.  
  3. function submitFrm()
  4. {
  5. document.submitform.action="complete.asp"
  6. document.submitform.submit();
  7. }
  8. function Validate()
  9. {
  10. var username = document.submitform.username.value;
  11. var password = document.submitform.password.value;
  12. var email = document.submitform.email.value;
  13. var str = ""
  14.  
  15. if (username=="")
  16. {str="Username";}
  17. if (password=="")
  18. {str=str + "\nPassword";}
  19. if (email=="")
  20. {str=str + "\nE-Mail";}
  21.  
  22. if (username=="" || password=="" || email=="")
  23. { alert("Please Fill out the following field:\n\n" + str);}
  24. else {return submitFrm();}
  25. }
  26. </script>
  27.  
  28. <form name="submitform" method="post" action="" OnSubmit="Validate()">
  29. <center>
  30. <table border=2>
  31. <tr><td>First Name:</td><td><input type="text" name="fname" size="32" /></td></tr>
  32. <tr><td>Last Name:</td><td><input type="text" name="lname" size="32" /></td></tr>
  33. <tr><td>Sex:</td><td><input type="radio" name="sex" value="Male">Male</input>
  34. <input type="radio" name="sex" value="Female">Female</input></td></tr>
  35. <tr><td>Username:</td><td><input type="text" name="username" size="32" /></td></tr>
  36. <tr><td>Password:</td><td><input type="password" name="password" size="32" /></td></tr>
  37. <tr><td>E-Mail:</td><td><input type="text" name="email" size="32" /></td></tr>
  38. <tr><td></td><td><center><input type="submit" value="Submit" /><input type="reset" value="reset" /></center></td></tr>
  39. </table>
  40. <%
  41. if request.querystring("new")="exists" then
  42. Response.Write("Username already exists in database.")
  43. end if
  44. %>
  45.  
It works fine, but I want to keep back the Firstname, lastname, sex, and e-mail values. How can I keep the values once it redirect the newuser page.

Because, if there is one invalide value, then it will redirect the same page and remove all values I input.

How can I keep firstname, lastname, sex, and e-mail values?
Thanks.
Apr 15 '06 #1
5 4531
meenu_susi
47 New Member
can u tell what u want to do ..
whether u want to post the data to nextpage
r else u want to check the use input data..
tell me in detail...
with regards
meenu
Jul 26 '06 #2
iam_clint
1,208 Recognized Expert Top Contributor
Based on the title of this thread
Expand|Select|Wrap|Line Numbers
  1. <%
  2. dim name
  3. name = Request("name")
  4. %>
  5. First Name: <input type="text" value="<%=name%>">
  6.  

or have no actuall submit button take action and onsubmit out of the form and use a button instead of a submit button and use on click so when you click it, it validates then sends the information otherwise you will stay on the same page and the javascript should display the errors without any refreshing done.
this will keep the values in the text field as the previous submitted form, if this wasn't what your are looking for then please rephrase your question.
Jul 26 '06 #3
meenu_susi
47 New Member
hi...
save the following code as html file and test it in your local server...

<
Expand|Select|Wrap|Line Numbers
  1.  html> 
  2. <head>
  3. <title>Untitled Document</title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  5. </head>
  6. <SCRIPT LANGUAGE=javascript>
  7. function fndelete()
  8.  
  9. {
  10. if (document.form.category.value=="")
  11. {
  12. alert("Please select values !");
  13. document.form.category.focus();
  14. return false;
  15. }
  16. if (document.form.sname.value=="")
  17. {
  18. alert("Content Field is Empty !");
  19. document.form.sname.focus();
  20. return false;
  21. }
  22. if (document.form.style.value=="")
  23. {
  24. alert("Content Field is Empty !");
  25. document.form.style.focus();
  26. return false;
  27. }
  28.  
  29.  
  30.  
  31. if (document.form.price.value=="")
  32. {
  33. alert("Content Field is Empty !");
  34. document.form.price.focus();
  35. return false;
  36. }
  37. if (document.form.shpcost.value=="")
  38. {
  39. alert("Content Field is Empty !");
  40. document.form.shpcost.focus();
  41. return false;
  42. }
  43.  
  44.  
  45. return true;
  46. }
  47. </SCRIPT>
  48.  
  49.  
  50.  
  51. <body bgcolor="#000000" text="#000000">
  52. <div align="center"> <p>&nbsp;</p><p><font color="#FF9900" size="3" face="Arial, Helvetica, sans-serif"><b>Tshirt 
  53. &nbsp;Entry</b></font></p>
  54.  
  55. <form name="form" method=post action="insert.asp" onsubmit="return fndelete();"> 
  56. <table width="44%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="41%" height="25"> 
  57. <div align="left"><font color="#CCCCCC" face="Arial, Helvetica, sans-serif" size="2">Category</font></div></td><td width="59%" height="25"> 
  58. <font color="#CCCCCC" face="Arial, Helvetica, sans-serif" size="2">
  59.  
  60. <SELECT NAME="category">
  61. <option value="cooltshirt">cooltshirt</option>
  62. <option value="funnytshirt">funnytshirt</option>
  63. <option>Beefy-T Youth</option>
  64. <option>Beefy-T Adult Long Sleeve </option>
  65. <option>Playwear Toddler</option>
  66. <option>Playwear Infant </option>
  67. <option>Playwear Infant Creeper</option>
  68. <option>Ultimate Crew Sweatshirt</option>
  69. <option>3/4 Sleeve Raglan </option>
  70. </SELECT></font></td></tr><TR> 
  71. <TD WIDTH="41%" HEIGHT="25"> <DIV ALIGN="left"><FONT COLOR="#CCCCCC" FACE="Arial, Helvetica, sans-serif" SIZE="2">Name</FONT></DIV></TD><TD WIDTH="59%" HEIGHT="25"> 
  72. <FONT COLOR="#CCCCCC" FACE="Arial, Helvetica, sans-serif" SIZE="2"> <INPUT TYPE="text" NAME="name"> 
  73. </FONT></TD></TR><TR> <TD WIDTH="41%" HEIGHT="25"> <DIV ALIGN="left"><FONT COLOR="#CCCCCC" FACE="Arial, Helvetica, sans-serif" SIZE="2">Style</FONT></DIV></TD><TD WIDTH="59%" HEIGHT="25"> 
  74. <FONT COLOR="#CCCCCC" FACE="Arial, Helvetica, sans-serif" SIZE="2"> <SELECT NAME="style"><OPTION>mens</OPTION><OPTION>womens</OPTION><OPTION>kids</OPTION></SELECT></FONT></TD></TR><TR> 
  75. <TD WIDTH="41%" HEIGHT="25"> <DIV ALIGN="left"><FONT COLOR="#CCCCCC" FACE="Arial, Helvetica, sans-serif" SIZE="2">Color</FONT></DIV></TD><TD WIDTH="59%" HEIGHT="25"> 
  76. <FONT COLOR="#CCCCCC" FACE="Arial, Helvetica, sans-serif" SIZE="2"> <INPUT TYPE="text" NAME="color"> 
  77. </FONT></TD></TR><TR> <TD WIDTH="41%" HEIGHT="25"> <DIV ALIGN="left"><FONT COLOR="#CCCCCC" FACE="Arial, Helvetica, sans-serif" SIZE="2">Size</FONT></DIV></TD><TD WIDTH="59%" HEIGHT="25"> 
  78. <FONT COLOR="#CCCCCC" FACE="Arial, Helvetica, sans-serif" SIZE="2"> <SELECT NAME="size">
  79. <option>S</option>
  80. <option>M</option>
  81. <option>L</option>
  82. <option>XL</option>
  83. <option>XXL</option>
  84. </SELECT></FONT></TD></TR><TR> 
  85. <TD WIDTH="41%" HEIGHT="25"> <DIV ALIGN="left"><FONT COLOR="#CCCCCC" FACE="Arial, Helvetica, sans-serif" SIZE="2">Quantity</FONT></DIV></TD><TD WIDTH="59%" HEIGHT="25"> 
  86. <FONT COLOR="#CCCCCC" FACE="Arial, Helvetica, sans-serif" SIZE="2"> <SELECT NAME="qty">
  87. <option>1</option>
  88. <option>2</option>
  89. <option>3</option>
  90. <option>4</option>
  91. <option>5</option>
  92. <option>6</option>
  93. <option>7</option>
  94. <option>8</option>
  95. <option>9</option>
  96. <option>10</option>
  97. </SELECT></FONT></TD></TR><TR> 
  98. <TD WIDTH="41%" HEIGHT="25"> <DIV ALIGN="left"><FONT COLOR="#CCCCCC" FACE="Arial, Helvetica, sans-serif" SIZE="2">Price</FONT></DIV></TD><TD WIDTH="59%" HEIGHT="25"> 
  99. <FONT COLOR="#CCCCCC" FACE="Arial, Helvetica, sans-serif" SIZE="2"> <INPUT TYPE="text" NAME="price"> 
  100. </FONT></TD></TR><TR> <TD WIDTH="41%" HEIGHT="25"> <DIV ALIGN="left"><FONT COLOR="#CCCCCC" FACE="Arial, Helvetica, sans-serif" SIZE="2">ShippingCost</FONT></DIV></TD><TD WIDTH="59%" HEIGHT="25"> 
  101. <FONT COLOR="#CCCCCC" FACE="Arial, Helvetica, sans-serif" SIZE="2"> <INPUT TYPE="text" NAME="shpcost"> 
  102. </FONT></TD></TR><TR> <TD WIDTH="41%" HEIGHT="25"> <DIV ALIGN="left"><FONT COLOR="#CCCCCC" FACE="Arial, Helvetica, sans-serif" SIZE="2">Image</FONT></DIV></TD><TD WIDTH="59%" HEIGHT="25"> 
  103. <FONT COLOR="#CCCCCC" FACE="Arial, Helvetica, sans-serif" SIZE="2"> <INPUT TYPE="file" NAME="image"></FONT></TD></TR><TR> 
  104. <TD WIDTH="41%" HEIGHT="25"> <DIV ALIGN="left"><FONT COLOR="#CCCCCC" FACE="Arial, Helvetica, sans-serif" SIZE="2">Description</FONT></DIV></TD><TD WIDTH="59%" HEIGHT="25"> 
  105. <FONT COLOR="#CCCCCC" FACE="Arial, Helvetica, sans-serif" SIZE="2"> <INPUT TYPE="text" NAME="descp"> 
  106. </FONT></TD></TR><TR> <TD WIDTH="41%" HEIGHT="25"> <DIV ALIGN="left"><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#CCCCCC">Pattern</FONT></DIV></TD><TD WIDTH="59%" HEIGHT="25"> 
  107. <FONT COLOR="#CCCCCC" FACE="Arial, Helvetica, sans-serif" SIZE="2"> <INPUT TYPE="text" NAME="pat"> 
  108. </FONT></TD></TR><tr><td colspan="2"><DIV ALIGN="CENTER"><FONT COLOR="red" SIZE="2" FACE="bolditalic"><B><FONT COLOR="red" SIZE="2" FACE="bolditalic"><INPUT TYPE="submit" NAME= "a2" VALUE="insert" SIZE="4"></FONT></B></FONT></DIV></td></tr> 
  109. </table></form><p>&nbsp;</p><p>s</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p></div>
  110. </body>
  111. </html>
  112.  
Jul 27 '06 #4
Niheel
2,456 Recognized Expert Moderator Top Contributor
Meenu,

Use the code tags , the " # " button to store code. Otherwise it disorts the page.

- KUB
Jul 27 '06 #5
meenu_susi
47 New Member
hi KUB


how to do that...
i am new to this forum..
can u tell me how to do..
Jul 27 '06 #6

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

Similar topics

7
43255
by: Anne | last post by:
hie there, i want to be able to pass multiple parameters to another page. currently, i am able to do so, but somehow i feel it is not the correct way to do it. below is part of what i have so far. 'first page Private Sub btnOK_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click Response.Redirect("InputValues.aspx?Requestor=" &
3
7859
by: Peter Row | last post by:
Hi, I better get the background stuff out the way first, so here goes: - Porting a VB6 webclass app to VB.NET using HttpHandlers and FormsAuthentication - When someone visits my site unbeknown to them they are automatically logged in as a guest via the .NET forms authentication.
2
3368
by: Pete | last post by:
Hi all... I sincerly hope one of the MS guys can clear this up for me... First some background... Ok, I have a web site which is fully translatable into several languages. All the strings for the web site are held in a database and all the labels, buttons etc are populated at run time in the Page_Load handler. The retreval of the strings from the database is all
6
2543
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 keep the information in the previous page intact when you get back to it?
9
2537
by: Adrian Parker | last post by:
We have a website that works everywhere but on a few PCs on this one site.. Asp.Net 1.1 Server = Windows 2003 Client = XP In the web.config we use - cookieless="false" in the browser settings they have "Always allow session cookies" set to true When the browser connects to the website the first page sets a session variable called "user_ref" to something and then calls another page. If on
2
3181
by: KFactor | last post by:
Is it possible to pass form variables to a page on another server using response.redirect? Or is there a secure way of passing sensitive information from one site to another such as a userID? I would like to avoid using the querystring. This is what I would like to do: When a user clicks on the link, I need to add them to the database and then
3
1800
by: Sharon | last post by:
hello all, I was successfull in passing one value from first webpage to second webpage, but not sure how to pass three textbox values from the first page to the second page. Below is the code i was using to pass a single value First WebPage: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
18
1732
by: John | last post by:
Something strange has just started to happen as I have been developing a db application on a site. Suddenly a session variable has stopped working as I pass it from 1 page to another (I am sure it was OK a few days ago). I have done some tests. $temp = 67; echo $temp; gives 67 on this page S_SESSION = $temp;
2
1659
by: phpmagesh | last post by:
Hi to all, I am creating a registration page, like name, last name, Date of birth, ph number, address etc.. When i click submit button all the values are taking to validation page using POST method. If any field is blank then script will say fill all the fields, then redirect to the registration page itself, During this process when redirecting to registration page i should get the existing values which i typed already.
0
7937
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
7874
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
8368
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...
0
6647
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
5738
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...
0
5403
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3893
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2383
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
1204
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.