473,386 Members | 1,758 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.

no call to the javascript function

can someone help me with the code below .there is no call to the checkForm function.I have just included the part to validate the name text area
platform: rational v6
os : xppro
language: javascript
source code

[HTML]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>
<HEAD>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM Software Development Platform">
<TITLE>state.jsp</TITLE>
<SCRIPT language="text/javascript">
<!--
function checkForm(){
valid=true;
if(document.input.fname.value==""){
alert("Enter name");
valid=false;
}
return valid;
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<FORM name="input" method="post" onSubmit="return checkForm();">
<TABLE border="0">
<TBODY>
<TR>
<TD width="133">Enter name</TD>
<TD width="270"><INPUT type="text" name="fname" size="20"></TD>
</TR>
<TR>
<TD width="133">Enter surname</TD>
<TD width="270"><INPUT type="text" name="fname0" size="20"></TD>
</TR>
<TR>
<TD width="133">Enter age</TD>
<TD width="270"><INPUT type="text" name="fname1" size="20"></TD>
</TR>
<TR>
<TD width="133">Select sex</TD>
<TD width="270"><INPUT type="radio" name="gender">Male <INPUT
type="radio" name="gender">Female</TD>
</TR>
<TR>
<TD width="133">Select province</TD>
<TD width="270"><SELECT name="province">
<OPTION value="default" selected>-select a province-</OPTION>
<OPTION value="Midlands">Midlands</OPTION>
<OPTION value="Matebeland">Matebeland</OPTION>
<OPTION value="Mashonaland">Mashonaland</OPTION>
</SELECT></TD>
</TR>
<TR>
<TD width="133"></TD>
<TD width="270"></TD>
</TR>
<TR>
<TD width="133"></TD>
<TD width="270"><INPUT type="submit" name="send" value="SUBMIT"></TD>
</TR>
</TBODY>
</TABLE>
</FORM>
</BODY>
</HTML>[/HTML]
Aug 27 '07 #1
4 1337
gits
5,390 Expert Mod 4TB
hi ...

i moved your post from the articles to the forum section ...

to your problem: use onclick="checkForm();" when you want the function to be called ... (probably at your submit button ;) )

kind regards
Aug 27 '07 #2
dmjpro
2,476 2GB
hi ...

i moved your post from the articles to the forum section ...

to your problem: use onclick="checkForm();" when you want the function to be called ... (probably at your submit button ;) )

kind regards
Yes Gits you are right.
But if he is having a button type submit then it's better to use ......
Expand|Select|Wrap|Line Numbers
  1. <form onsubmit="checkForm();">
  2.  
Kind regards,
Dmjpro.
Aug 27 '07 #3
acoder
16,027 Expert Mod 8TB
But if he is having a button type submit then it's better to use ......
Expand|Select|Wrap|Line Numbers
  1. <form onsubmit="checkForm();">
  2.  
That should be [HTML]<form ... onsubmit="return checkForm();">[/HTML] Don't forget the return.
Aug 27 '07 #4
acoder
16,027 Expert Mod 8TB
can someone help me with the code below .there is no call to the checkForm function.I have just included the part to validate the name text area
What error message do you get? One problem might be the name you've given your form. Rename "input" to something else; even "inputForm" will be fine.
Aug 27 '07 #5

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

Similar topics

15
by: chirs | last post by:
I am trying to understand a piece of code. In a javascrpit file, there is a function: function ItemStyle(){ var names=; addProps(this,arguments,names,true); }; In the html file, it calls...
5
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...
1
by: cheezebeetle | last post by:
ok, so I am having problems passing in an ASPX function into the Javascript in the codebehind page. I am simply using a confirm call which when they press "OK" they call this ASPX function, when...
3
by: JoeK | last post by:
Hey all, I am automating a web page from Visual Foxpro. I can control all the textboxes, radio buttons, and command buttons using syntax such as: ...
39
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. ...
18
by: Chris Ianson | last post by:
Hi geniuses (or is that genii, or genies) The challenge is as above really. I have a page with an iframe in it, and need to call a JS function in the *parent* page, *from* inside the iframe. ...
3
by: KaNos | last post by:
Hi, "robot script pages" are html+javascript pages, can be played in aspx player. So in this tech, robot call aspx player's function (an interface is sheared) and wait a result synchronously with...
3
by: Angus | last post by:
I have a web page with a toolbar containing a Save button. The Save button can change contextually to be a Search button in some cases. Hence the button name searchsavechanges. The snippet of...
10
by: evicailieva | last post by:
A have a php scrip where I call a JavaScript function. I don't know why, but it doesn't work. At the beginning, when I was writing the script it was working but now it's not. I don't know wхat to do....
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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...
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,...

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.