JS confirm to html->image-> link

Hello I would like to ask, how can I insert JS confirm to image as link ?>>


	<?php echo $html->image("delete.png", array(
    "alt" => "Brownies",
    'url' => array('controller' => 'messages', 'action' => 'delete',$value['Message']['ID']),
	 array('escape' => false),sprintf(__('Are you sure you want to delete this message %s?', true), $value['Message']['ID']))); ?>

Thanks for any advice..

Asked by blacksymmetry, on 10/3/10

3 Answers

I want to copy&paset my example,

but actualy the first one also working.

with , before the sprintf

if you in the same controler you don't need 'controller' => 'messages'

and i giva a title not a alt for a link.

alt for a image come into $html->image part.

look in HTML what you have as output.


echo $html->link(  $html->image("delete.png")
, array('action' =>'delete', $value['Message']['ID'])
, array('title' => 'Brownies')
, sprintf('Are you sure you want to delete this message %s?', $value['Message']['ID'])
, false);

Answered by joleon 11/3/10


$html->link(
  $html->image("delete.png"),
  array(
      'controller' => 'messages', 'action' =>'delete',$value['Message']['ID']
    ),
  array(
    'alt' => 'Brownies',
  )
  sprintf(__('Are you sure you want to delete this message %s?', true), $value['Message']['ID']
    ),
false
  )
);

Answered by dogmatic69on 10/3/10

Thanks, but example does not working.

I tried this with same result:

link(

$html->image("delete.png"),

array('controller' => 'messages', 'action' =>'delete',$value['Message']['ID']),

array('alt' => 'Brownies'),sprintf(__('Are you sure you want to delete this message %s?', true), $value['Message']['ID'] ),false);?>

blacksymmetry - on 10/3/10

<< comments | 1 | 2

See your defalt.ctp layout in the core.

CAKEPHP POWER button has the format you wants( without confirm message,but bit additional)

Answered by hiromion 11/3/10

<< previous next >>

Rating

0

Viewed

402 times

Last Activity

on 11/3/10