473,781 Members | 2,729 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reset the form to Null or Reload the page usign reset even after a submit

46 New Member
Hi everyone,

This is the scenario:

I have two button - Submit and Reset

Submit is used for validation and after validation is passed it passes it to another form to enter into database.

Bascially the reset works fine if I use it before using the submit button in the form. For instance,if on submit there is some error as the values have not passed a validation. There is a error pop up message shown and the values are retained in the field and Now if I use reset , all the values of the field do not go back to null.

I am new with form validation. I checked online and it said that reset will not clear if we have used submit and we need to use javascript to do it.

So I made reset into a button which onclick event calls the reset() function and clears the form but I am sure that the code is not right as it is not working, I tired putting a alert message in my fucntion to reassue that the function is being called but I think it is not.

Posting my code

[code]

<INPUT id=reset1 name=reset1 type =button value=Reset onClick="reset( )">

<Script>
function reset()
{
alert ("all values shall be cleared now");

document.frmUse r.name = "" ;
document.frmUse r.user = "" ;
document.frmUse r.contactNumber = "";
document.frmUse r.email = "" ;

}
</Script>

I am not sure if its the best way to do it.

I want the whole form to refresh/ reload everytime reset is clicked and all the fields to have no values.

Thanks for the help in advance.

Sree
Jul 5 '07
16 16689
sreemati
46 New Member
Thanks gits,

Can you help with reloading a page with parameters passed as being passed by the previous page?
Hi Solved my problem.

I figured out. My solution code is:

Expand|Select|Wrap|Line Numbers
  1. function reset_page()
  2. {
  3. document.location.reload("location?type=<%=USER_TYPE%>");
  4. }
  5.  
  6.  
[html]
<INPUT type=button value=Reset onClick = “reset_page()”>
[/html]

Thanks for all help and support.
Sree
Jul 6 '07 #11
sreemati
46 New Member
I would be of great help if someone can tell mehow to reload/ refersh the page I am in currently but I need to be able to pass a hidden parameter whoes values MUST be taken as if coming from the next page and I am stuck as to how to pass this value along with reload event in javascript.

Can anyone help?

My code is:

[js]

function reset_page()

{
document.locati on.reload();
}

I am getting error saying: The page can not be refreshed without resending the information. click retry to sent the information again, or click Cancel to return to the page that you were trying to view.

Can I anyone say how can I reload/refresh my page by passing the hidden values.

Thanks in advance.
Sree
Hi Solved my problem.

I figured out. My solution code is:

[js]
function reset_page()
{
document.locati on.reload("loca tion?type=<%=US ER_TYPE%>");
}

[/js]

[html]
<INPUT type=button value=Reset onClick = “reset_page()”>
[/html]

Thanks for all help and support.
Sree
Jul 6 '07 #12
dafodil
392 Contributor
Anytime.... anytime....
Jul 6 '07 #13
gits
5,390 Recognized Expert Moderator Expert
... glad you got it working ... and that you find the solution for yourself ;) ... come back when you have more questions ...

kind regards
Jul 6 '07 #14
acoder
16,027 Recognized Expert Moderator MVP
Merged the threads.
Jul 6 '07 #15
acoder
16,027 Recognized Expert Moderator MVP
[js]
function reset_page()
{
document.locati on.reload("loca tion?type=<%=US ER_TYPE%>");
}

[/js]
Sree, it's good that you got your problem solved. Just one thing about the code tags. [js] won't work. Use [code=javascript] with the ending code tag. Thanks.
Jul 6 '07 #16
sreemati
46 New Member
Sree, it's good that you got your problem solved. Just one thing about the code tags. [js] won't work. Use [code=javascript] with the ending code tag. Thanks.

Thanks a lot. Yes, sure will rem that the next time.

Cheers
Sree
Jul 6 '07 #17

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

Similar topics

9
30122
by: Ken | last post by:
How can I reset the initial form variables that are set with session statements when clicking on a button? I tried this but the function was not called: <?PHP function reset_form($none) { $_SESSION = array(); } ?> <form enctype="multipart/form-data" name="company_info" method="post" action="add_pic.php">
0
1551
by: David Virgil Hobbs | last post by:
What programming codes will enable me to achieve interaction between vb or c# and HTML form values, without a page reload occurring every time a script is run? At least with javascript and vb script you can run scripts that change form values WITHOUT page reloads. What a weird language vb/c#/asp.net is turning out to be. . Every time you click a button, the whole page refreshes and you lose your scrolling position. What are the languages...
1
1603
by: Simon Wigzell | last post by:
I have a form with several different submit buttons that does different thinkgs depending which button is clicked. (All the submit buttons are named "Submit" and my form uses the asp request.form("Submit") to get the value of the button clicked) I would like another page to not only submit the form on this page - I can do that by having a function: window.name = "MyPage:
3
11879
by: David N | last post by:
Hi All, I just wonder if in C#, I can develop a user defined control that can call its parent function which is not yet developed. For example, how do I make my user control call a to-be-developed-function cmdOkay_Click() function as described below. 1. Create an user control that contains an OK button as below Public Class MyButton:System.Windows.Form.UserControl
0
986
by: drisso | last post by:
I found it convenient in asp.net 1.1 that you could easily define a dataadapter through a wizard and when the page reloads the initialize component would recreate it for you each time. Now that the initialize component in 2.0 is only called once when the application loads each time a call back is done or the page load is called the dataadapter is null. Is there anyway that I don't have to create the dataadapter manually in the pageload? ...
1
3608
by: norman29 | last post by:
Hi all! How can i do this: <form method="get" action="test.asp" > <input name="boys" type=radio value="John">John <input name="boys" type=radio value="Lu">Lu <input name="boys" type=radio value="James">James <input name="student" type=checkbox value="yes">student? and now: if student=yes then this boy is a student:
3
9245
by: nkoriginal | last post by:
Hello: I tried an script for keep my data form after reload page, but I've some errors. In this momento I runnung my own browser because we've an intranet. And for security reason, our page reload every 10 minutes for keep my login live. But, we've some forms, and 10 minutes is a shorcut time to do that, and very 10 minutos, our page reload, and we lose all data in form (before submit). So, for that reason , I want to keep my data after...
1
4035
by: nkoriginal | last post by:
Hello Again: I've a problem with my forms. I woking with an intranet, and the pages in that intranet, has a reload page, every 10 minutos. So my problems star, when any user stay in my forms for more longe than 10 minutes, and the page reload, the user lose all data in that forms, if he not did submit. I want to keep the user form data, after reload. Is that possible? so, en litle words, if the user stay in my forms and he filled...
1
8950
devonknows
by: devonknows | last post by:
hi ive got this at the end of my settings page, and i want it show the fmrSearch form change the check1.value, but everytime i do it, it takes two or three attempts for it to change (having to go back into settings and press ok again) so i put fmrsearch.refresh inhope that it would refresh the form and update the Check1.value. but it doesnt is there anywya i can force my form to reload? so it reloads all the form_load values?. please let me know...
0
9639
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
9939
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8964
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
7486
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
6729
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
5375
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5507
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4040
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
3
2870
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.