Javacript error when using quotes in list name
-
Hello,
I have detected an error with the MailPoet Subscriber field.
Steps to reproduce:
- Create a list with a name with double quotes in it, like My “amazing” list
- Create a new gravity form: it is not possible to add any field
Thanks to developer tools I’ve been able to see where the problem com from:
the MailPoet subscribe field load all the MailPoet lists as default value.
The names of the lists are not properly encoded which causes this issue.I was able to fix it by changing line 151 in add-on-gravity-forms-mailpoet.php
Instead of:
$choice .= 'new Choice("'.$value["name"].'","'.$value["id"].'"), ';
I wrote
$choice .= 'new Choice('.json_encode(esc_html($value["name"])).',"'.$value["id"].'"), ';
Now everything is working fine again!
- The topic ‘Javacript error when using quotes in list name’ is closed to new replies.