473,408 Members | 1,858 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,408 software developers and data experts.

multipe steps in button click

can someone help to get this working ?
<input type="submit" value="Submit"
onclick=" if (document.forms[ 0 ].password == ''){
alert('please enter a password')}
elseif (document.forms[ 0 ].password != ''){
alert('please be patient while your history is loading')}"
>

Aug 1 '06 #1
1 1281

Jon Paal wrote:
can someone help to get this working ?
<input type="submit" value="Submit"
onclick=" if (document.forms[ 0 ].password == ''){
alert('please enter a password')}
elseif (document.forms[ 0 ].password != ''){
alert('please be patient while your history is loading')}"
>
It would be better if you've handled the submission on the form element
instead:

<form action = "yourpage.ext" onsubmit = "return checkMyForm(this)">

In your javascript, you can then define a function to do what you
wanted in the following example:

function checkMyForm(myForm)
{
if(myForm.elements["password"].value == "")
{
alert("please enter a password");
return false;
}
else
{
alert("please be patient...");
return true;
}
}

The thing you were missing was the 'value' property. Note that
returning false will not submit your form and returning true will.

Aug 1 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Niks | last post by:
Hi, I am new to ASP.NET. I have to develop a SIMPLE web based project in ASP.NET. I have a few questions reagarding that - 1) Do we need to create a new project by selecting ASP.NET web...
11
by: CW | last post by:
I have message entry screen that's causing me a bit of an issue. At the moment, there are 2 buttons, one is used to send message to another user (btnSend) and another is used to send messages to...
1
by: Klaus Jensen | last post by:
Hi! This has been annoying me all day, and I can't get it to work It is really driving me nuts! Basicly this simple webapp created to illustrate my problem, renders five buttons, and adds a...
3
by: Imran Aziz | last post by:
Hello All, I have a search text and button that post data and my button handler filters the repeater control. However when the button is clicked the first time. The page_load event is being called...
0
by: Bill Gauvey | last post by:
I have a wizard control on a page with the first two setps are static, created in the VS2005 UI; the remaining steps are created dynammically. For some reason I cant get it to retain in the...
0
by: U S Contractors Offering Service A Non-profit | last post by:
Baby steps to the "New" New Orleans Inbox Reply Craig Somerford to Chasing, Donald, me, (bcc:Discovery), (bcc:Beijing) show details 3:55 pm (0 minutes ago) Our Beloved New Orleans needs you...
5
by: Nick Gilbert | last post by:
Hi, I'm using the asp:Wizard control and on some of the steps, I would only like the user to be able to progess to the next step by clicking an image button. Therefore I would like to be able to...
4
by: Jim | last post by:
I there a way to return values for multiple variable from a fuction. The following does not work because it give me a syntax error Private Sub Button3_Click(ByVal sender As System.Object, ByVal e...
9
by: Jonathan Wood | last post by:
Does anyone know of any reason a button on a master page would have no effect? I have a complex HTML page that I'm converting to ASP.NET, and acknowledge I could have something odd that is...
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
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
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...

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.