Formats javascript assignment for form validation api
with proper escaping of a value.
public static getJsValueForFormValidation ( string $key, string $value, boolean $addOn, boolean $comma ) : string | ||
$key | string | Name of value to set |
$value | string | Value to set |
$addOn | boolean | Check if $.validator.format is required or not |
$comma | boolean | Check if comma is required |
return | string | Javascript code. |
/** * Prints javascript assignment for form validation api * with proper escaping of a value. * * @param string $key Name of value to set * @param string $value Value to set * @param boolean $addOn Check if $.validator.format is required or not * @param boolean $comma Check if comma is required * * @return void */ public static function printJsValueForFormValidation($key, $value, $addOn = false, $comma = true) { echo Sanitize::getJsValueForFormValidation($key, $value, $addOn, $comma); }