HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 20th, 2000, 03:23 PM
deviant deviant is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 27 deviant User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Is it possible to force the curser into the next text box once the preceeding one has reached maxlength? If so how......

in need to input a string broken into 6 sets of 2 characters....ie 55:66:77:88:99:00...
when the data is filled in i want the input to fluidly jump to the next text box..

thanks

Reply With Quote
  #2  
Old July 20th, 2000, 03:57 PM
billyo billyo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 114 billyo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Hi. I wasn't sure what the best event would be for calling the function that will move focus (I used onkeypress, but I don't think NS has that event). I don't know if this will help you, but as an alternative you could just use one text box, and let the user enter the characters as a string. Then you could call the function "SPLITM()" which just creates a character array out of your string. Then it pairs off the characters and you could format them however you want or just leave them as elements in the array.
Here you go:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre><html>
<head>
<script language="JavaScript"><!--
function MOVEIT(i)
{
if (document.forms[0].elements[i-1].value.length >1)
{
document.forms[0].elements[i].focus()
}
}
function SPLITM()
{
var STRING = document.forms[1].elements[0].value;
var TEST=STRING.split("") //if you call the split method with the empty string as an argument it will return a character array.
alert(TEST[0]+TEST[1]+":"+TEST[2]+TEST[3]+":"+TEST[4]+TEST[5]) // then you could just pair off the array elements.
}
//--></script>
</head>
<body>
<form>
<table>
<tr>
<td><input type=text onkeypress=MOVEIT(1)></td>
<td><input type=text onkeypress=MOVEIT(2)></td>
<td><input type=text onkeypress=MOVEIT(3)></td>
<td><input type=text onkeypress=MOVEIT(4)></td>
<td><input type=text onkeypress=MOVEIT(5)></td>
<td><input type=text onkeypress=MOVEIT(6)></td>
<tr><td><input type=submit value="all done"></td></tr>
</tr>
</table>
</form>
<form><table><tr><td><input type=text></td></tr></table><input type=button value="SPLITM()" onclick=SPLITM()></form>
</body>
</html>[/code]

Reply With Quote
  #3  
Old July 20th, 2000, 04:42 PM
deviant deviant is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 27 deviant User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for the reply...but thats not what I need....i do combine the fields once inside of my perl script.
The fields are broken up to avoid invalid characters being entered when creating new DNS Hardware Address entries (hence the 55:66:77:88:99:00). I just want a fancy form that progresses to the next text box.

Thanks again....

Reply With Quote
  #4  
Old July 20th, 2000, 05:37 PM
billyo billyo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 114 billyo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Uhh, that first function "MOVEIT()" changes focus to the next text box when the length of the value in the one preceding it exceeds 2 digits. That's not it? You could also use some high tech RegEx on your web page to validate entries. JS 1.2 supports RegEx well.

Reply With Quote
  #5  
Old July 21st, 2000, 09:30 AM
deviant deviant is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 27 deviant User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Sorry, now that I've tried the code by itself it works......only problem is whenever I move the code into my existing page it returns the following:

Error: 'document.forms.0.elements[...].value' is not an object

This error pops up when entering any character into the input boxes with the MOVEIT() attached ????????

Thanks

[This message has been edited by deviant (edited July 21, 2000).]

Reply With Quote
  #6  
Old July 21st, 2000, 10:18 AM
deviant deviant is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 27 deviant User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
OK....works great now.....increased the form from 0 to 1 because I had 2 forms on the page.....thanks for everything

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > Advancing Text box......possible?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway