Html entities converrsion in onchange function in php

54 views Asked by At

When I try to pass variables to check_holiday_dates_on_application I want them to be surrounded by ' in the site html. This is what my code looks like:

'onchange' => 'return check_holiday_dates_on_application(\'' . $this->Url->webroot('') . '\', \'' . $token . '\',' . json_encode($abstractionDayList) . '\');']); ?>

What I want is

onchange="return check_holiday_dates_on_application('webroot',token','abstractionDayList');"

What I get is

onchange="return check_holiday_dates_on_application('webroot', 'token',abstractionDayList');"

Can anyone help me out?

2

There are 2 answers

0
Scrottz On BEST ANSWER

Worked with setting the parameter

'escape' => false

Thanks for the answer @Greg Schmidt in the comments.

1
TSCAmerica.com On

Try this, hope it helps

'onchange' => 'return check_holiday_dates_on_application(\'' . $this->Url->webroot('') . '\', \'' . $token . '\', ' . json_encode($abstractionDayList) . ');'