Menu
Hi All,
I am having 4 text boxes.I want automatically go to the next text box once user entered 50 characters in one box also same time I want to wrap the word means if the word is not completed in one textbox(50 characters limit is reached) I want to take that word to next text box.
I will really appriciate if someone can help me out.
Thanks.
<TR>
<TD ><input type="text" maxlength="50"
size="70" name="comment" /></TD>
</TR>
<TR>
<TD><input type="text" maxlength="50"
size="70" name="t2" /></TD>
</TR>
<TR>
<TD><input type="text" maxlength="50"
size="70" name="t3" /></TD>
</TR>
<TR>
<TD><input type="text" maxlength="50"
size="70" name="t4" /></TD>
</TR> [/QUOTE]
Each text box is having max length of 50.What I want
is when Iam typing in one line
and the max.length reached i.e 50 char cursor
automatically go to the next textfield
with wrapping the uncompleted word in first text box
to next textbox.
For example:
Text Field 1 :"I am testing the script for you if it is perfect then you ha
Text Field 2 : ve to test this."
suppose the limit comes after"ha" the "have" should
wrap and come to the second line
like this
TextField 1: "I am testing the script for you if it is perfect then you
TextField 2: have to test this."
I am able to come automatically to the next line once
the size is reached
but not able to wrap the word.
I will appriciate the help
var nBreaks = 0;
function flowTo(isField,isNext){
if (isField.full == 0)
{
currText = isField.value.replace(/^ /,"")
isField.value = currText;
if (currText.match(/rn/g)){nBreaks = currText.match(/rn/g).length}
nChar = currText.length-nBreaks;
if (nChar == 50)
{
isField.full = 1;
lastChar = currText.charAt(currText.length-1);
if (lastChar == " "){isNext.focus();}
else {
wrapStr = currText.substring(currText.lastIndexOf(' '),currText.length)
isField.value = currText.substring(0,currText.length-(wrapStr.length-1))
isNext.focus();
isNext.value = wrapStr;
}
}
}
else {isField.value = isField.value.substring(isField.value[0],isField.value.length-1)}
}
function limitChar(isField){
currText = isField.value.replace(/^ /,"")
isField.value = currText;
if (currText.match(/rn/g)){nBreaks = currText.match(/rn/g).length}
nChar = currText.length-nBreaks;
if (nChar > 50)
{
isField.value = isField.value.replace(/rn$/,"");
isField.value = isField.value.substring(0,isField.value.length-1);
}
}
var nBreaks = 0;
var prevText = "";
function flowTo(isField,isNext){
if (isField.full == 0)
{
currText = isField.value.replace(/^ /,"")
isField.value = currText;
if (currText.match(/rn/g)){nBreaks = currText.match(/rn/g).length}
nChar = currText.length-nBreaks;
if (nChar == 50)
{
isField.full = 1;
lastChar = currText.charAt(currText.length-1);
if (lastChar == " "){isNext.focus()}
else {
wrapStr = currText.substring(currText.lastIndexOf(' '),currText.length)
isField.value = currText.substring(0,currText.length-(wrapStr.length-1))
isNext.focus();
isNext.value = wrapStr;
}
if (prevText == ""){prevText = isField.value}
}
}
else {
if (event.keyCode == 8 || event.keyCode == 13)
{
isField.value = prevText;
}
else {
isField.value = isField.value.substring(isField.value[0],isField.value.length-1)
}
}
}
function limitChar(isField){
currText = isField.value.replace(/^ /,"")
isField.value = currText;
if (currText.match(/rn/g)){nBreaks = currText.match(/rn/g).length}
nChar = currText.length-nBreaks;
if (nChar > 50)
{
isField.value = isField.value.replace(/rn$/,"");
isField.value = isField.value.substring(0,isField.value.length-1);
}
}
var nBreaks = 0;
var prevText = "";
function flowTo(isField,isNext){
if (isField.full == 0)
{
currText = isField.value.replace(/^ /,"")
isField.value = currText;
if (currText.match(/rn/g)){nBreaks = currText.match(/rn/g).length}
nChar = currText.length-nBreaks;
if (nChar == 50)
{
isField.full = 1;
lastChar = currText.charAt(currText.length-1);
if (lastChar == " "){isNext.focus()}
else {
wrapStr = currText.substring(currText.lastIndexOf(' '),currText.length)
isField.value = currText.substring(0,currText.length-(wrapStr.length-1))
isNext.focus();
isNext.value = wrapStr;
}
prevText = isField.value;
}
}
else {
if (event.keyCode == 8 || event.keyCode == 13)
{
isField.value = prevText;
}
else {
isField.value = isField.value.substring(isField.value[0],isField.value.length-1)
}
}
}
function limitChar(isField){
currText = isField.value.replace(/^ /,"")
isField.value = currText;
if (currText.match(/rn/g)){nBreaks = currText.match(/rn/g).length}
nChar = currText.length-nBreaks;
if (nChar > 50)
{
isField.value = isField.value.replace(/rn$/,"");
isField.value = isField.value.substring(0,isField.value.length-1);
}
}
var nBreaks = 0;
var prevText = "";
function flowTo(isField,isNext){
if (isField.full == 0)
{
currText = isField.value.replace(/^ /,"")
isField.value = currText;
if (currText.match(/rn/g)){nBreaks = currText.match(/rn/g).length}
nChar = currText.length-nBreaks;
if (nChar == 50)
{
isField.full = 1;
lastChar = currText.charAt(currText.length-1);
if (lastChar == " "){isNext.focus()}
else {
wrapStr = currText.substring(currText.lastIndexOf(' '),currText.length)
isField.value = currText.substring(0,currText.length-(wrapStr.length-1))
isNext.focus();
isNext.value = wrapStr;
}
prevText = isField.value;
}
}
else {
if (event.keyCode == 8 || event.keyCode == 13)
{
isField.value = prevText;
}
else {
isField.value = isField.value.substring(isField.value[0],isField.value.length-1)
}
}
}
function limitChar(isField){
currText = isField.value.replace(/^ /,"")
isField.value = currText;
if (currText.match(/rn/g)){nBreaks = currText.match(/rn/g).length}
nChar = currText.length-nBreaks;
if (nChar > 50)
{
isField.value = isField.value.replace(/rn$/,"");
isField.value = isField.value.substring(0,isField.value.length-1);
}
}
0.1.9 — BETA 5.18