Hello Everyone,
After a long search i found solution to validate php tags using javascript from input values in magento.
I have modified magento/js/prototype/validation.js file and added new class to validate php tags:
You can review below code inside ‘Validation.addAllThese’ array to add new class to validate php tags.
['validate-no-php-tags', 'PHP tags are not allowed', function(v) {
return !/<\?[=|?php]?[\s\S]*?\?>/.test(v) && !/<\?[=|php]?[\s\S]*?/.test(v) && !/\?[\s\S]*?/.test(v) ;
}],
you can use ‘validate-no-php-tags’ css class in input tag in magento.
Above validation will validate tags like ‘<?php’, ‘<?’, ‘?>’, ‘<?php ?>’, ‘<? ?>’.
I hope above solution works like charm.
Thanks,
Bijal Bhavsar