CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Limit number of characters [Resolved]

Print topic Send  topic

Author Message
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 .
View profile  Send private message
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)."....");
}
View profile  Send private message
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
View profile  Send private message
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
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.