I have a landing page that I am using SSJS to submit form fields to a data extension. The form fields contain HTML characters (which will import to the Data Extension fine) but, trying to update the Data Extension from the landing page throws this error:

A potentially dangerous Request.Form value was detected from the client 

The error is being thrown because the field contains < and > characters.

I am wondering if there is a way to replace those characters before submitting, or encode them in some way prior to entering the data extension? I know AMPscript has a Replace function, but not sure how I can use it within SSJS to achieve what I'm after.

Is there a Replace function, or something similar within SSJS? Or another way to approach submitting these fields to the data extension?


Base64Decode() is available in SSJS. You would have to encode before sending in.



You can replace in SSJS as you can in AMPScript.

I would go for urlencoding, so it stays sort of human readable in the DE and can be shown on e.g. a cloudpage.

<script type="javascript" runat="server">
var yourinput = "<html></html>";
yourinput = yourinput.replace("<","%3C");
yourinput = yourinput.replace(">","%3E");



See https://www.urldecoder.org/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.