473,769 Members | 4,584 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 #1
16 16685
epots9
1,351 Recognized Expert Top Contributor
i might have heard about this, or maybe its somethings else but..

what language are u using to write the webpage? HTML, PHP, ASP.NET?
Jul 5 '07 #2
sreemati
46 New Member
i might have heard about this, or maybe its somethings else but..

what language are u using to write the webpage? HTML, PHP, ASP.NET?
I am using ASP page. Its just I want to set all the field values to null when we click reset. Javascript tutorials mention usign reset value but my IE browser says, does not support this object. So I may have to set all the values back to null??? I am nto sure, actually confused :D
Jul 5 '07 #3
kovik
1,044 Recognized Expert Top Contributor
Just like forms have a submit() function, they have a reset() function. You don't have to make your own.

Expand|Select|Wrap|Line Numbers
  1. <input type="submit" value="Submit" />
  2. <input type="reset" value="Reset" />
Jul 5 '07 #4
sreemati
46 New Member
@ volectrcity

We have a reset but if the form is called back after failure in validation i.e. once a submit event has happened, the reset button does not clear the form rather, it sets it with the values that were entered before.

Thats why I have to do it with javascript
Jul 5 '07 #5
epots9
1,351 Recognized Expert Top Contributor
if your using visual studio for your ASP page, right click the reset button and go to properties. then in there there should be an option for performsubmit, set that to false, and another option to use validator controls set that to false as well

good luck
Jul 5 '07 #6
sreemati
46 New Member
if your using visual studio for your ASP page, right click the reset button and go to properties. then in there there should be an option for performsubmit, set that to false, and another option to use validator controls set that to false as well

good luck
Thanks epots and velo.

I have solved how to set all the values to null but I think I would rather want to reload/ refersh the whole page but there is a hidden type whoes values MUSt be taken from the comign form 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 for your efforts.
Sree
Jul 5 '07 #7
gits
5,390 Recognized Expert Moderator Expert
[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>
hi ...

you have to set the value-property so add .value to the lines ... when you want to set a value of an input-field

kind regards
Jul 6 '07 #8
sreemati
46 New Member
hi ...

you have to set the value-property so add .value to the lines ... when you want to set a value of an input-field

kind regards
Thanks gits,

Can you help with reloading a page with parameters passed as being passed by the previous page?
Jul 6 '07 #9
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
Jul 6 '07 #10

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

Similar topics

9
30114
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
11878
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
985
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
8944
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
9587
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
10045
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...
1
9993
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
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...
1
7406
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
6672
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();...
1
3958
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
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
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.