Back to PhocaGalleryRenderFront class

Method renderDescriptionCreateCatJS

public static
renderDescriptionCreateCatJS
(mixed $chars)

Method renderDescriptionCreateCatJS - Source code

public static function renderDescriptionCreateCatJS($chars)
{
    $tag = "<script type=\"text/javascript\"> \n" . "function countCharsCreateCat() {" . "\n" . "var maxCount\t= " . $chars . ";" . "\n" . "var pfcc \t\t\t= document.getElementById('phocagallery-create-cat-form');" . "\n" . "var charIn\t\t= pfcc.phocagallerycreatecatdescription.value.length;" . "\n" . "var charLeft\t= maxCount - charIn;" . "\n" . "" . "\n" . "if (charLeft < 0) {" . "\n" . "   alert('" . Text::_('COM_PHOCAGALLERY_MAX_LIMIT_CHARS_REACHED', true) . "');" . "\n" . "   pfcc.phocagallerycreatecatdescription.value = pfcc.phocagallerycreatecatdescription.value.substring(0, maxCount);" . "\n" . "\tcharIn\t = maxCount;" . "\n" . "  charLeft = 0;" . "\n" . "}" . "\n" . "pfcc.phocagallerycreatecatcountin.value\t= charIn;" . "\n" . "pfcc.phocagallerycreatecatcountleft.value\t= charLeft;" . "\n" . "}" . "\n" . "function checkCreateCatForm() {" . "\n" . "   var pfcc = document.getElementById('phocagallery-create-cat-form');" . "\n" . "   if ( pfcc.categoryname.value == '' ) {" . "\n" . "\t   alert('" . Text::_('COM_PHOCAGALLERY_ENTER_TITLE', true) . "');" . "\n" . "     return false;" . "\n" . "   } else {" . "\n" . "     return true;" . "\n" . "   }" . "\n" . "}" . "\n" . "</script>";
    return $tag;
}