Search code examples
javascriptphpcakephpconfirmation

CakePHP delete confirmation


I have problem with Cake PHP delete javascript confirmation dialog.

I am using this code:

<td><?php echo $this->Html->link('Delete',
                                        array('controller' => 'RealEstate', 'action' => 'delete',$r['RealEstate']['id']),
                                        array('onclick'=>'return confirm(\"Are you sure?\");'))?> </td>

and this produce html:

<td><a onclick='return confirm(\"Are you sure?\");' href="/cake1/RealEstate/delete/65">Delete</a> </td>

as you can see this produce wrong Html.

How to fix this ?

FIXED: Problem was in back slashes \"Are you sure?\", just removed \ and this works well "Are you sure?"


Solution

  • FIXED: Problem was in back slashes \"Are you sure?\", just removed \ and this works well "Are you sure?"