+ Start a Discussion
kprkpr 

Issue with JSINHTMLENCODE()

Hi,

 

I'm trying to encode text a user would input in an inputtext field, so that it doesn't allow malicious characters.

 

This is the input field
<input type="text" id="custAttType" />

In my script tag, I use this:
var custType = $('#custAttType').val();             
var custTypeValue = {!JSINHTMLENCODE(custType)};

 

 

However I get this error:


Error: Unknown property 'MyTypes__cStandardController.custType'

 

I tried different ways, but with the same error:

var custTypeValue = "{!JSINHTMLENCODE(custType)}";

var custTypeValue = {!JSINHTMLENCODE(custType+'')};

 

Am I using the function right?

 

Thanks in advance

kpr

kiranmutturukiranmutturu

try to give the merge field inside the fucntion also..