473,624 Members | 2,252 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript -- confused on the return false -- simple validate function?

Hi.

I have an hmtl page with a function to see if there are any input text
boxes. If so, that means a user did not complete them (once entered,
my xsl stylesheet makes them text instead of text input boxes, so
there should be NO input boxes when the user is clicking the FINISH
button. However, the FINISH button script still indicates that input
boxes exist...new to this...return false issue? Is there a better way
to do this? I also need to send a querystring or form collection for
(hidden_birth2. aspx?finish=yes ). I couldn't get the script right to
open the page with querystring from the function, so I ended up doing
it with this <form> element...proba bly not the best way. Any help
appreciated! Thanks. Kathy

function CheckInput()
{
var cnAll = document.all;
for (var i=0;i<cnAll.len gth;i++)
{
if(cnAll(i).tag Name=='INPUT')
{
alert("You must first complete and SAVE all user inputs!");
return false; }
}
}

HTML snippet:

<form action="Hidden_ Birth2.aspx" method="post" onsubmit="retur n
CheckInput();">
<input type="Submit" name="finish" value="FINISH">
<b>Click the FINISH button when work instruction is complete.</b>
</form>
Jul 20 '05 #1
4 1965
>
HTML snippet:

<form action="Hidden_ Birth2.aspx" method="post" onsubmit="retur n
CheckInput();">


I think you need the capital S for it to work ......... but I could be wrong

onSubmit="retur n validate();"
Jul 20 '05 #2
"Chris Leonard" <c.************ *@btinternet.co m> writes:
I think you need the capital S for it to work ......... but I could be wrong

onSubmit="retur n validate();"


You are wrong.
In HTML, the case of the letters doesn't matter.
In XHTML, and in Javascript, the on<event> handlers are written in
all lower case.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3
Are you sure your for loop isn't detecting the "input type submit" ?

Might be worth checking the cnAll(i).type as well.

Also, I think your event handler might need to return true.

Hope that helps,
Ron
Jul 20 '05 #4
Ugh, just realized that I should have other input boxes just not
type=TEXT boxes...could someone help me with testing for input elements
where type=TEXT?

Thanks!

Kathy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #5

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

Similar topics

5
2672
by: Sue | last post by:
After finishing up my first quarter JavaScript on 12/12/03, I decided to improve character checking on my project. In my project I only had to do very basic validation. Therefore, I only had one function to verify the name fields, age, email and gender. My question is: if I create a function for each field like the code below, what would be the best way to organize the functions and call them? Would I need one main function and place...
2
1439
by: GIMME | last post by:
Background ... I've created a web application that allows a user to create an HTML application from IE. The application itself creates an XML representation of a XHTML form. The XHTML representation can be saved as a string and recreated. (The application also has a crude workflow aspect - so XMHTML forms can be created and assigned a workflow. Forget I said anything about
4
9463
by: Madha K | last post by:
I am developing a web application that need to support UTF-8 characters. For client side validations, can javascript be used to handle UTF-8 characters. 1) How javascript can be used to restrict non-utf8 characters? 2) Using javascript how to find the lengh of a string having unicode characters? e.g: For a field Name on the form, there is a corrosponding field Name varchar2(10) in DB. Through my application when i try enter 10 normal...
6
2142
by: francisco lopez | last post by:
ok , first of all sorry if my english is not so good, I do my best. here is my problem: I don´t know much javascript so I wrote a very simple one to validate a form I have on my webpage. could you please have a look at the following script: ------------------------------------------------------------
4
7286
by: Steph | last post by:
Hello, Can someone tell me the script to use for having a change on the same page when using checkbox function ? For example, i would to check one condition and display dynamically a button if the condition is checked on the same page. Thanks in advance for your help
7
3593
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title> </head> <style type="text/css">
12
2749
by: KL | last post by:
Is there a way to redirect with javascript? I used javascript to do some validation on a form, but the form was set to redirect back to the index page after the submit button was clicked. So what I want to do is to say if it passes validation, then redirect, but if it doesn't pass, I want it to stay on the page so the user can fix the problems and click submit again. Can I even do this in javascript? -- KL
2
1937
by: Mick Walker | last post by:
Hi, I have a problem that I have been trying to figure for a couple of days, and am wondering if anyone out there would be so kind as to give me a solution. (Deadline time) I am trying to validate a form. Its quite a simple form, but I am a wee bit stuck. Baically it consists of 9 text input fields and a select element. All elements on the form, have to have a value in them (manditory), BUT 2 items (txtEmail, and txtDOB) have to match...
4
68174
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer must be embedded somewhere in the source code, and I would like to know if anyone knows where to find the correct answer. I would greatly appreciate it!! Thanks!!
0
8242
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
8177
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
8681
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8629
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
8341
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
7170
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
6112
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...
1
2611
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
1488
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.