set to 255. This maxlength value seems to get ignored as the user can enter
unlimited characters. Does the multiline textbox not support maxlength?
How can I make the work?
TIANo the max length doesn't work as the html tag rendered is a textarea tag,
which has no MaxLength property.
You will need to use a Validator control to ensure the length doesn't exceed
the MaxLength. You could use a RegExValidator or derive your own from
CustomValidator.
HTH,
bill
"hardcoded" <mtanner42@.hotmail.com> wrote in message
news:%23qTtyUtMEHA.3668@.TK2MSFTNGP11.phx.gbl...
> I have a textbox with TextMode set to MultiLine. I also have the
MaxLength
> set to 255. This maxlength value seems to get ignored as the user can
enter
> unlimited characters. Does the multiline textbox not support maxlength?
> How can I make the work?
> TIA
Just as I suspected. Thanks!
"William F. Robertson, Jr." <wfrobertson@.kpmg.com> wrote in message
news:eFOrUWtMEHA.3664@.TK2MSFTNGP10.phx.gbl...
> No the max length doesn't work as the html tag rendered is a textarea tag,
> which has no MaxLength property.
> You will need to use a Validator control to ensure the length doesn't
exceed
> the MaxLength. You could use a RegExValidator or derive your own from
> CustomValidator.
> HTH,
> bill
>
> "hardcoded" <mtanner42@.hotmail.com> wrote in message
> news:%23qTtyUtMEHA.3668@.TK2MSFTNGP11.phx.gbl...
> > I have a textbox with TextMode set to MultiLine. I also have the
> MaxLength
> > set to 255. This maxlength value seems to get ignored as the user can
> enter
> > unlimited characters. Does the multiline textbox not support maxlength?
> > How can I make the work?
> > TIA
"hardcoded" <mtanner42@.hotmail.com> wrote in message
news:udF5XYtMEHA.2704@.TK2MSFTNGP10.phx.gbl...
> Just as I suspected. Thanks!
Not much you can do on any web-based application. Price to pay for ! :)
John
try the this
<HTML>
<HEAD>
<SCRIPT>
function fun_pTextarea_MaxLen(prm_oTextarea_Obj)
{var var_sKey_Code, var_aKey_Special, var_bResult,
var_oTextarea_TxtRng;
var_oTextarea_TxtRng = prm_oTextarea_Obj.createTextRange();
var_aKey_Special = [8,17,18,27,33,34,35,36,37,38,39,40,45,46,114];
var_bResult = true;
var_sKey_Code = event.keyCode;
if (var_sKey_Code == 86)
{if (event.ctrlKey) var_bResult =
fun_mTextarea_Paste(prm_oTextarea_Obj);}
if(prm_oTextarea_Obj.value.length >= prm_oTextarea_Obj.maxLen)
{var_bResult = false;
if (var_oTextarea_TxtRng.queryCommandState('OverWrite ') &&
(prm_oTextarea_Obj.value.length == prm_oTextarea_Obj.maxLen))
{var_bResult = true; }
else
{
for (i=0; i<var_aKey_Special.length; i++)
{if (var_sKey_Code == var_aKey_Special[i]){var_bResult = true;
break;}}
}
}
return var_bResult;
}
function fun_mTextarea_Paste(prm_oTextarea_Obj)
{var var_sClipboard_Text;
var_sClipboard_Text = window.clipboardData.getData("Text");
prm_oTextarea_Obj.TxtRng =
document.selection.createRange().duplicate();
if (prm_oTextarea_Obj.TxtRng && prm_oTextarea_Obj.createTextRange)
{prm_oTextarea_Obj.TxtRng.text =
prm_oTextarea_Obj.TxtRng.text.charAt(prm_oTextarea _Obj.TxtRng.text.length
- 1) == ' ' ? var_sClipboard_Text + ' ' : var_sClipboard_Text;
}
else
{prm_oTextarea_Obj.TxtRng.text = var_sClipboard_Text;}
prm_oTextarea_Obj.value = prm_oTextarea_Obj.value.substring(0,
prm_oTextarea_Obj.maxLen);
return false;
}
</SCRIPT>
</HEAD>
<BODY>
<textarea maxLen=10 onkeydown="return
fun_pTextarea_MaxLen(this);"></textarea>
</BODY>
</HTML
(phoenix398017)
"hardcoded" <mtanner42@.hotmail.com> wrote in message news:<#qTtyUtMEHA.3668@.TK2MSFTNGP11.phx.gbl>...
> I have a textbox with TextMode set to MultiLine. I also have the MaxLength
> set to 255. This maxlength value seems to get ignored as the user can enter
> unlimited characters. Does the multiline textbox not support maxlength?
> How can I make the work?
> TIA
0 comments:
Post a Comment