Results 1 to 5 of 5

Thread: Make sure input isn't "555" and jumping problem

  1. #1
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Default Make sure input isn't "555" and jumping problem

    Hey, I'm not that good with javascript, at all, i have this piece of code from w3schools (which works for the first two inputs) the 3 inputs are for the phone input...
    The code is here:
    HTML Code:
    <head>
    <script type="text/javascript">
    function checkLen(x,y)
    {
    if (y.length==x.maxLength)
      {
      var next=x.tabIndex;
      if (next<document.getElementById("booking").length)
        {
        document.getElementById("booking").elements[next].focus();
        }
      }
    }
    </script>
    </head>
    <body>
    <label for="phone">Phone Number:</label>
    		<br /><span class="phone">
    			(<input size="3" tabindex="3" name="phone1" maxlength="3" onkeyup="checkLen(this,this.value)">)
    			-
    			<input size="3" tabindex="4" name="phone2" maxlength="3" onkeyup="checkLen(this,this.value)">
    			-
    			<input size="3" tabindex="5" name="phone3" maxlength="3" onkeyup="checkLen(this,this.value)">
    						</span>
    </body>
    I want to make sure that phone2 doesn't equal 555 and if it does, it disables the submit button...

    if someone could also figure out why it won't jump from phone2 to phone3 even though the max length is full that would be stellar!

    Thanks!

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Up the other code,,,I can't see the booking id yet
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. #3
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Default

    The whole thing is there...
    HTML Code:
    <html>
    <head>
    <script type="text/javascript">
    function checkLen(x,y)
    {
    if (y.length==x.maxLength)
      {
      var next=x.tabIndex;
      if (next<document.getElementById("booking").length)
        {
        document.getElementById("booking").elements[next].focus();
        }
      }
    }
    </script>
    <style type="text/css">
    .phone{
    	font-family: Trebuchet Ms;
    	color: #444444;
    	font-size: 14px;
    	font-weight: bold;
    	}
    .dankforms input, select{
    	background: url('dankforms/background.gif');
    	border: 1px solid #AAAAAA;
    	font-family: Trebuchet Ms;
    	color: #444444;
    	font-size: 14px;
    	font-weight: bold;
    	}
    .dankforms textarea{
    	background-color: #FFFFFF;
    	border: 1px dashed #AAAAAA;
    	font-family: Trebuchet Ms;
    	color: #444444;
    	font-size: 14px;
    	font-weight: bold;
    	overflow: auto;
    	}
    .dankforms fieldset{
    	font-family: Trebuchet Ms;
    	color: #4e4e4e;
    	font-weight: normal;
    	font-size: 10px;
    	border: 1px dashed #AAAAAA;
    	border-top: none;
    	padding-left: 15px;
    	width: 450px;
    	}
    .dankforms legend{
    	
    	font-family: Trebuchet Ms;
    	color: #0000FF;
    	font-weight: normal;
    	font-size: 10px;
    	text-indent: -10px;
    	}
    .dankforms label{
    	border: none;
    	font-family: Trebuchet Ms;
    	color: #4e4e4e;
    	font-weight: normal;
    	font-size: 10px;
    	}
    </style>
    </head>
    <body>
    <form action="booking.php?step=2" method="post" class="dankforms" id="booking">
    <fieldset><legend>Contacting You</legend>
    	<label for="fName">Your First Name:</label>
    		<br />
    			<input type="text" name="fName" size="15" maxlength="15" tabindex="1" />
    		<br />
    	<label for="lName">Your Last Name:</label>
    		<br />
    			<input type="text" name="lName" size="15" maxlength="15" tabindex="2" />
    		<br />
    	<label for="phone">Phone Number:</label>
    		<br /><span class="phone">
    			(<input size="3" tabindex="3" name="phone1" maxlength="3" onkeyup="checkLen(this,this.value)">)
    			-
    			<input size="3" tabindex="4" name="phone2" maxlength="3" onkeyup="checkLen(this,this.value)">
    			-
    			<input size="3" tabindex="5" name="phone3" maxlength="3" onkeyup="checkLen(this,this.value)">
    						</span>
    		<br />
    		<label for="site">Your Venue's site:</label>
    			<br />
    				<input type="text" value="http://" name="site" maxlength="100" size="50" tabindex="6" />
    				
    </fieldset>
    <hr color="FEFEFE" />
    <fieldset>
    <legend>Venue Info</legend>
    	<label for="vName">Venue Name:</label>
    		<br />
    			<input type="text" name="vName" size="30" maxlength="30" tabindex="7" />
    		<br />
    	<label for="vAddress">Venue Address: like (10 Example Street)</label>
    		<br />
    			<input type="text" name="vAddress" size="50" maxlength="50" tabindex="8" />
    		<br />
    	<label for="vInfo">Venue Description:</label>
    		<br />
    			<textarea cols="50" rows="4" maxlength="400" tabindex="9" >
    			</textarea>
    		<br />Good info to include is stage size (width and length), whether there is a P.A system, inside or outside, most common music played onstage, whether there are bouncers, dance floor size, parking, and security.  Must be able to host minors on stage.  Friendly Enviroment and or staff?  These are all things we would love to know before we even think about calling you up.
    	<br />
    	** We currently are only touring in the U.S **
    	<br />
    	<label for="state">State Venue Resides in:</label>
    		<br />
    			<select name="state" size="1" tabindex="10">
    				<!--State list Ridiculous long list -->
    			</select>
    	<br />
    	<label for="city">City which the Venue is in:</label>
    		<br />
    			<input type="text" name="city" size="20" maxlength="30" tabindex="11" />
    		<br />
    </fieldset>
    <fieldset>
    <legend>How this is gonna go down...</legend>
    	This info is going to be emailed to our email account dedicated for booking.  Once we look over the application we will call you up and talk with you about whether its plausible or totally not possible.  If we it's plausible give us some rough dates and times of when the gig might happen.  Then we will talk some more. 
    <br />
    <br /><b>Notice:</b>
    <br />Dank Lemon is located in the wonderful state of Virginia and still has their parents drive them around.  We need atleast a month to plan out a show in the state of Virginia.  If your venue is outside of the state of Virginia (even if its on the borderline) we need 2-3 months notice.
    	<br /><input type="submit" value="Send your Request" />
    	<br />
    	<br /><input type="reset" value="Reset Application" />
    edit: I just put up the whole page...
    Last edited by Rockonmetal; 04-11-2008 at 09:44 PM.

  4. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    EDIT: Sorry, lol, I didn't know you we're the one asking.
    Last edited by Nile; 04-11-2008 at 09:55 PM.
    Jeremy | jfein.net

  5. #5
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Try adding this in your script:
    Code:
    window.onload = function()
    {
    	var phone2 = document.getElementById('booking').phone2;
    	var submit = document.getElementById('booking').mysubmit;
    	phone2.onblur = function()
    	{
    	var filter = Number(this.value);
    	if(filter == 555)
    		{
    		submit.disabled = 'disabled';
    		}
    	}
    }
    ...Also give your submit button a name....use mysubmit for instance

    See if it helps
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  6. The Following User Says Thank You to rangana For This Useful Post:

    Rockonmetal (04-12-2008)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •