Joe-Bloggs
Posts: 10
|
Posted: 02/23/2016, 6:37 AM |
|
I think this question was asked before,
I need to limit the number of characters for a label "news" to 160 , but can not figure the code,
can any one help .
|
|
|
saseow
Posts: 744
|
Posted: 02/23/2016, 6:51 AM |
|
This may put you on the right path. In the BeforeShow event of the label:
global $var;
$var=$Component->GetValue();
if (strlen($var)>160){
$Component->SetValue(substr($Component->GetValue(),1, 10)."....");
}
|
|
|
Joe-Bloggs
Posts: 10
|
Posted: 02/23/2016, 7:29 AM |
|
Thanks Saseow , works perfect .
global $var;
$var=$Component->GetValue();
if (strlen($var)>160){
$Component->SetValue(substr($Component->GetValue(),0, 160)."....");
}
Returns 157 characters
|
|
|
DataDoIT
|
Posted: 02/23/2016, 7:39 AM |
|
Keep them from ever having the opportunity of entering more than 160
characters on the client-side. See http://ndpsoftware.com/show_char_limit.php
|
|
|
Joe-Bloggs
Posts: 10
|
Posted: 02/23/2016, 7:48 AM |
|
Thanks Datadoit, that wont work here, this is a short snip of text with a more link
|
|
|
|