Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 24th, 2004, 09:49 AM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Chris, I corrected what you told me to.... it almost work!.
The following scenario has strange result though... please, try it and tell me.
If it works for you in Netscape, then I will give up!!
- tabulator on field1 => cursor goes to field4 (ok)
- focus on field1 again and enter something
- tabulator on field1 => cursor goes to field2 (ok)
- enter something on field2 (or don't ... the result is the same!)
- tabulator on field2 => cursor goes to field1 !!!!!

 
Old November 24th, 2004, 09:57 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hey Elisabeth,

Afraid it still works for me. Can you publish it somewhere on the net, check it doesn't work for you & then post the url so I can take a look?

Cheers,

Chris
 
Old November 24th, 2004, 10:02 AM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That is strange!!!
Unfortunately, I can't publish it on the net... I would not know where!. I only have my intranet to test it and it does not work!.
Sorry you cannot take a look.
Well, I guess this is it then.
Thank you very much anyway for your time. I will try to do without it!



 
Old November 24th, 2004, 10:34 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Elisabeth,

Very frustrating!!!

Another approach would be to check the value of the field each time a key is released, at least this way someone will not get confused when they try to focus on field 2 or 3 after clearing field 1 & in addition it might even work for you...
Code:
<html>

<head>
  <title></title>

<script type="text/javascript">
function initForm1(form)
{
    var f1 = form.field1.value;
    if (!f1.match(/^(\s)*$/) ) 
    {
        form.field2.disabled = form.field3.disabled = false;
    }
    else
    {
        form.field2.disabled = form.field3.disabled = true;
        form.field2.value = form.field3.value = "";
        setTimeout("document.forms." + form.name + ".field1.blur(); document.forms." + form.name + ".field1.focus();");
    }
    return true;
}
</script>

</head>

<body onload="initForm1(document.forms.myForm);">

<form name="myForm">
Field1:
<input type=text name="field1" tabindex=3  onkeyup="initForm1(this.form);"> 
<br>
Field2:
<input type=text name="field2" tabindex=4 disabled="disabled">
<br>
Field3:
<input type=text name="field3" tabindex=5 disabled="disabled">
<br>
Field4:
<input type=text name="field4" tabindex=6>
</form>

</body>

</html>
HTH,

Chris

 
Old November 24th, 2004, 11:07 AM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It works!!!! You are the best!!!!
Thank you so much!!






Similar Threads
Thread Thread Starter Forum Replies Last Post
javaScript function in asp.net not work in firefox rsanuj ASP.NET 1.x and 2.0 Application Design 1 February 8th, 2007 11:37 AM
calling a codebehind function on onblur event vishnupriya.kamalakaram ASP.NET 1.0 and 1.1 Basics 2 July 7th, 2006 08:25 AM
How to call a codebehin function on onblur event?? kv Priya ASP.NET 1.0 and 1.1 Professional 1 June 14th, 2006 02:43 PM
can't seem to get the mail() function to work Graham76 BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 October 5th, 2004 01:59 PM
function that doesn't work hosefo81 PHP How-To 1 March 10th, 2004 03:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.