473,386 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Disable submit data

150 100+
//the code
[HTML]<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TEST form</title>
<script type="text/javascript">
function check()
{
txt1= document.getElementById("username")
txt2= document.getElementById("password")
if(document.getElementById("username").value=="")
{
alert(document.getElementById("username").name);

}
if(document.getElementById("password").value=="")
{
alert(document.getElementById("password").name);

}
return true
}
</script>
</head>
<body>
<div align="right">
<form id="form1" name="form1" method="post" action="test-2.php" onsubmit="return check()">
<label> Username:
<input type="text" name="username" id="textfield" />
<br />
Password:
<input type="text" name="password" id="textfield2" />
<br />
<input type="submit" name="Login" id="Login" value="Submit" />
</label>
</form>
</div>
</body>
</html>[/HTML]
in this code i need to disable the form to Submit the data to another page and how to simplify the code without using if statement many times
Jul 5 '07 #1
1 1562
acoder
16,027 Expert Mod 8TB
You want to stop the form submission. Add "return false" after the alerts.
Jul 6 '07 #2

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

Similar topics

5
by: JML | last post by:
Hi guys, I need HELP I am trying to disable submit button after user submits the form. thanks in advance --
5
by: http://links.i6networks.com | last post by:
I want to force the users to click submit to submit the forms. How do I disable "Enter Key" which will submit the form automatically when they entered the data in text field then pressed "enter key"
14
by: Sinity | last post by:
Anyone knows the method/codes to disable the clicked button after first click by using .aspx-- to prevent people to click many time when waiting for the server response. I tried to do this by...
3
by: Jeff | last post by:
I have a payment form with a submit button. A large percentage of users double-click the submit button thus submitting their payment information twice. I would like to use javascript to disable...
16
by: Barry Gilmore | last post by:
Is there a way to disable a button after it is clicked? I am trying to avoid having someone click on it twice while they wait for it to process. Thank you!
8
by: GS | last post by:
Hi, This is probably known solution but I have not found it in minimum amount of code. I'd like to disable button on client-side after clicking on it. Just disabling it in javascript do not...
4
by: Patrick Flaherty | last post by:
Hi, Experienced programmer but new to PHP. Moreover I'm to use PHP with Xoops on top (this adds object orientation?). I don't seem to find a xoops Usenet group? Whatever the case (and...
5
by: Sehboo | last post by:
In my application, there are lot of processes which take several seconds. What we want is that once user clicks on a button (or link or whatever) and while we are processing that request, we don't...
5
by: andersond | last post by:
I need to enable or disable a submit button based on the value of a data field stored in a database. I have found working examples of how to enable or disable based on a checkbox; but, I need it to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...

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.