Back to PhocaDownloadRenderFront 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() {" . "\n" . "var maxCount\t= " . $chars . ";" . "\n" . "var pdu \t\t\t= document.getElementById('phocadownload-upload-form');" . "\n" . "var charIn\t\t= pdu.phocadownloaduploaddescription.value.length;" . "\n" . "var charLeft\t= maxCount - charIn;" . "\n" . "" . "\n" . "if (charLeft < 0) {" . "\n" . "   alert('" . Text::_('COM_PHOCADOWNLOAD_MAX_LIMIT_CHARS_REACHED') . "');" . "\n" . "   pdu.phocadownloaduploaddescription.value = pdu.phocadownloaduploaddescription.value.substring(0, maxCount);" . "\n" . "\tcharIn\t = maxCount;" . "\n" . "  charLeft = 0;" . "\n" . "}" . "\n" . "pdu.phocadownloaduploadcountin.value\t= charIn;" . "\n" . "pdu.phocadownloaduploadcountleft.value\t= charLeft;" . "\n" . "}" . "\n" . "</script>";
    return $tag;
}