Back to PhocaGalleryRenderFront class

Method renderDescriptionUploadJS

public static
renderDescriptionUploadJS
(mixed $chars)

Method renderDescriptionUploadJS - Source code

public static function renderDescriptionUploadJS($chars)
{
    $tag = "<script type=\"text/javascript\"> \n" . "function countCharsUpload(id) {" . "\n" . "var maxCount\t= " . $chars . ";" . "\n" . "var pfu \t\t\t= document.getElementById(id);" . "\n" . "var charIn\t\t= pfu.phocagalleryuploaddescription.value.length;" . "\n" . "var charLeft\t= maxCount - charIn;" . "\n" . "" . "\n" . "if (charLeft < 0) {" . "\n" . "   alert('" . Text::_('COM_PHOCAGALLERY_MAX_LIMIT_CHARS_REACHED', true) . "');" . "\n" . "   pfu.phocagalleryuploaddescription.value = pfu.phocagalleryuploaddescription.value.substring(0, maxCount);" . "\n" . "\tcharIn\t = maxCount;" . "\n" . "  charLeft = 0;" . "\n" . "}" . "\n" . "pfu.phocagalleryuploadcountin.value\t= charIn;" . "\n" . "pfu.phocagalleryuploadcountleft.value\t= charLeft;" . "\n" . "}" . "\n" . "</script>";
    return $tag;
}