Hi,
I've this piece of code which does not work at all.
Can anyone point out my mistake?
I've 2 buttons. History button will call verifyFields() function and
lead to
different page for processing. verifyFields() is working fine and so
does the
history() function.
But,
the other save button doesn't work. It's supposed to call the save()
function and before executing the action, it will perform a check by
executing
checkFormFields (). However it does not execute these statements:
--------------------------------------------------------------------
document.ListFo rm.target="orig in";
document.ListFo rm.action="List ByOrigin_update record.asp?acti on=check";
--------------------------------------------------------------------
The links above have been verified and it's working.
<SCRIPT LANGUAGE="JavaS cript">
<!--
function checkFormFields ()
{
if(!isNumber(Li stForm.destinat ion.value))
{
alert("Destinat ion must not contain numbers at all.");
ListForm.destin ation.focus();
return false;
}
return true;
}
function history()
{
document.ListFo rm.target="adho c";
document.ListFo rm.action="List ByOrigin.asp?ac tion=check";
}
function save()
{
if (checkFormField s() ) //doesn't execute these 2 lines.
{
document.ListFo rm.target="orig in";
document.ListFo rm.action="List ByOrigin_update record.asp?acti on=check";
return true;
}
}
//-->
</script>
<form action="" method="post" name="ListForm" onSubmit="retur n
verifyFields(); ">
<input name="submit" type="submit" value="History"
onClick="histor y()">
<input name="submit" type="submit" id="submit" value="Save"
onClick="return save();">
</form> 2 2413
kelvin wrote: Hi,
I've this piece of code which does not work at all. Can anyone point out my mistake?
I've 2 buttons. History button will call verifyFields() function and lead to different page for processing. verifyFields() is working fine and so does the history() function.
But,
the other save button doesn't work. It's supposed to call the save() function and before executing the action, it will perform a check by executing checkFormFields (). However it does not execute these statements: -------------------------------------------------------------------- document.ListFo rm.target="orig in"; document.ListFo rm.action="List ByOrigin_update record.asp?acti on=check"; -------------------------------------------------------------------- The links above have been verified and it's working.
<SCRIPT LANGUAGE="JavaS cript">
<script type="text/javascript">
<!--
<!-- Not needed.
function checkFormFields () { if(!isNumber(Li stForm.destinat ion.value))
Where is "isNumber() " defined? It's not in the source you provided. As a result any
attempt to call isNumber() will result in a syntax error.
{ alert("Destinat ion must not contain numbers at all."); ListForm.destin ation.focus(); return false; } return true; }
function history() { document.ListFo rm.target="adho c"; document.ListFo rm.action="List ByOrigin.asp?ac tion=check"; }
function save() { if (checkFormField s() ) //doesn't execute these 2 lines.
As indicated above, checkFormFields () contains a call to an undefined function.
{ document.ListFo rm.target="orig in"; document.ListFo rm.action="List ByOrigin_update record.asp?acti on=check"; return true; }
You use "return save()" on the form, but save() does not always return a value, you should
add "return false;" here. It may work without it, but it's a good habit to have functions
that are supposed to return something always explicitly return something.
} //-->
//--> Not needed
</script>
<form action="" method="post" name="ListForm" onSubmit="retur n verifyFields(); ">
<input name="submit" type="submit" value="History" onClick="histor y()">
<input name="submit" type="submit" id="submit" value="Save" onClick="return save();">
</form>
--
| Grant Wagner <gw*****@agrico reunited.com>
* Client-side Javascript and Netscape 4 DOM Reference available at:
* http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
* http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
hi Grant,
I've done some changes and it works now.
Thank you for your advise. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Erik |
last post by:
I need to submit a form using a hyperlink, and I need to pass a
variable associated with that hyperlink.
Example: I have a page where employees enter event information, and
they are supplied a dropdown box to pick the promoter for that event.
If the promoter does not exist in the database, they need to add
him/her to the database so that the promoter can be associated with
the event. If the promoter does not exist, I want to provide a...
|
by: mscir |
last post by:
I was calling a function in a js file from an image onClick event, but
someone still using Netscape 4 (!) complained that it didn't work. I
read that img onClick doesn't work in Netscape 4, so swithced it to
"javascript:show(...);" and the code works, but I read in this group
that it was not wise to do that, here's the working version, using the
not recommended approach:
<a href="javascript:show('art_2.jpg','600','448');" target="_self">...
|
by: Kevin Lyons |
last post by:
Hello,
Can anyone assist me with what I am trying to do with the following
code (six different scenarios to try to make the functionality work
correctly)?
I want to always (and ONLY) display in the status bar 'Symantec
Corporation' whenever anyone mouses over (onMouseOver) my image or
link OR when one clicks while holding the left mouse down (onClick) on
the same image or link. Upon releasing the mouse (onMouseOut), the
|
by: Jamie Jackson |
last post by:
I'm rewriting all links' onclick events, but I'm having a problem. The
onclick event that I'm inserting works correctly in Opera, but not in
FF or IE.
I'm retroactively adding the statement "return promptBeforeOpening();"
FF and IE rewrite it as I would expect them to, but it turns out that
that doesn't work (no disclaimer pops up, and the link is not
disabled):
|
by: Noozer |
last post by:
Is it possible to detect where on a page the click occurred when the OnClick
event of the BODY tag is fired?
Thx
| |
by: Eric-Sebastien Lachance |
last post by:
Hey there,
I decided to just create a 100% height and width div that filled the
space over a background header image, and add an onclick event to
redirect to the my index... Doesn't seem to work in FireFox only, just
in IE. Here's the code:
<div id="headerimg"><div style="width: 100%; height: 100%; cursor:
hand; cursor: pointer;"
onclick="top.location.href('http://www.monamouchtim.com/');"> </div></div>
|
by: pagates |
last post by:
Hello All--
I'm having a problem getting an onclick event to work. Here is my setup: I
have an external JavaScript file, a master page that registers the javascript
as an external file, and a content page that has controls that I am trying to
get onclick to work for.
// =====================
// MyScriptFile.js
// =====================
|
by: Daz |
last post by:
Hello everyone. I am sure the answer to my question is simple, but I
can't seem to dynamically add an onClick event to my script.
I have a table which is generated dynamically, I am just struggling
getting an onClick event to show in the HTML source.
Any help would be appreciated. Here is a block of my current code which
doesn't work.
var tr1 = document.createElement('tr');
|
by: Michael_R_Banks |
last post by:
I'm trying to dynamically build a table that allows users to remove
rows when they click a corresponding button. For some reason,
whenever I add the button to the table, it never fires the onclick
event. I'm stumped with this one, any assistance would be
appreciated.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"...
|
by: Charles |
last post by:
Hello,
On my web site, I have a <selectdrop-down menu that allows to show/
hide divs: http://tchernobyl.dreamhosters.com - The problem is that it
doesn't work in IE7 (only tested in Opera and Firefox). However, if I
include the onclick event in an <atag, it works fine in IE (but not
within <optiontags). Next to the drop-down menu, I put a "test" link
which works fine in IE7. Do you know what may be the cause? Here's the
snippet:
|
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,...
| |
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...
|
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...
|
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...
|
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...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |