Hi All,
I have a form with multiple text boxes. I want to have one validation
routine, and, if something fails, I'd like to put the focus in that
text box.
So, how can I 'remember' which text box I came from, so I know which to
send the focus back to? They all have different names, but I do not
want to code something like this for every text box:
function datevalidation( entered, alertbox) {;
with (entered) {;
if (value==\"?\");
{if (alertbox!=\"\" ) {alert(alertbox );} return false;};
else {return true;};
};
};
if (emailvalidatio n(Email1,\"Ille gal E-mail\")==false) {Email1.focus() ;
return false;};
Any suggestions?
Thanks. 1 2970
JRS: In article <11************ *********@g44g2 000cwa.googlegr oups.com>,
dated Tue, 6 Dec 2005 13:04:28 local, seen in news:comp.lang. javascript, am****@iwc.net posted : I have a form with multiple text boxes. I want to have one validation routine, and, if something fails, I'd like to put the focus in that text box.
So, how can I 'remember' which text box I came from, so I know which to send the focus back to? They all have different names, but I do not want to code something like this for every text box:
function datevalidation( entered, alertbox) {; with (entered) {; if (value==\"?\"); {if (alertbox!=\"\" ) {alert(alertbox );} return false;}; else {return true;}; }; };
if (emailvalidatio n(Email1,\"Ille gal E-mail\")==false) {Email1.focus() ; return false;};
Any suggestions?
<URL:http://www.merlyn.demo n.co.uk/js-valid.htm#VFF>, but start reading
at the beginning of the page.
Also, ==false is silly; see ! in
<URL:http://www.merlyn.demo n.co.uk/js-logic.htm#OO>, ditto.
<URL:http://www.merlyn.demo n.co.uk/js-other.htm#Dbg> : Code should be
indented, by a couple of spaces per level, to show the logical
structure.
There's no point is having an else after an if ... return.
--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Fred Snider |
last post by:
Help!
Opening a new window using the window.open( ) command works great
for opening new windows and having them on top and having the focus.
The window.focus command brings any existing windows to the front
(top) in Netscape, IE and Opera. However, this command does nothing
when you access the web page through AOL, even though they say this is
IE. Once a window is behind (blurred), I have been unable to bring it
back to the front...
|
by: Tony G. |
last post by:
Hi there,
I have an APS 3 application, running on a Windows 2003 Web edition server -
it is a very busy website, and when users are click on certain links
(membership info), a new window i opened via javascript.
This new window is on the SAME website as where the user is located, but
just opened in HTTPS (secure) mode - the user can now examine memberhip terms
and continue to buy membership.
|
by: CW |
last post by:
I wrote an HTML based chat application. The front end is built entirely on
HTML + javascript. Essentially, I have a hidden frame that's refreshed
frequently and any new messages are displayed in another frame using
document.write. My problem is that since chat screen can be obscured by
other applications/windows, I have no way of informing users that new
messages have arrived other than popping the window to the top using
window.focus....
|
by: s_m_b |
last post by:
I'm building a suite of online forms for insurance. These have been
stripped down from messy MS Word templates, and two of the six,
substantially identical, are misbehaving with the .js page that validates
some of the content.
The correct behaviour is that some fields must have content, some must
have valid dates/times. On validation, the form is POSTed to a processing
page that flows it into a blank template and emails that elsewhere.
...
|
by: IkBenHet |
last post by:
Hello,
I found this script to create a simple rich text form
(http://programmabilities.com/xml/index.php?id=17):
<html>
<head>
<title>Rich Text Editor</title>
</head>
<body>
| |
by: Andrew |
last post by:
Hi,
I got this problem, I developed my asp.net c# apps in my own pc that has
IE6, and I recently moved it onto the server that is using IE v5. I found out
that my javascript is not compatible with IE5. Can someone please help me to
spot where and why there is now an error in my javascript ? I have listed it
below:
<script language="javascript">
function CheckKey() {
|
by: damonwischik |
last post by:
I'm using GNU Emacs 21.3.1 with python-mode 1.0alpha under Windows XP.
Whenever I execute a command in an edit window (with
py-execute-region), the output window steals the focus. How can I stop
this happening?
I don't know any lisp, but I hacked together this routine so that that
when I press ctrl+return the entire current block is executed.
(defun py-execute-paragraph (vis)
"Send the current paragraph to Python
|
by: Fuman |
last post by:
Thank you for reading my question. Let me know if you need more info.
I am using a WebControl DataGrid. also I am using a Javascript command to move focus to another field.
RegisterStartupScript("", "<script language='javascript'>document.Form1.txtStock.focus();</script>")
if I comment out this command, then everything is fine.
but if I leave the code uncomment, then whenever the I edit the datagrid, it does not go into the...
|
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: 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: 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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |