How can I ask for confirmation before opening an anchor? |
I have an anchor...
Code: <?php echo anchor("main/confirmSent/$r->Submitted", 'Mark Sent', 'class="button icon approve"'); ?>
For that you have to use JavaScript as the folowing native e.g.
Code: <a href="#" onclick="if (confirm('Wollen Sie diese Domain wirklich löschen?')) { location.href = 'your_link'; } return false;"> Your e.g. should work like that (untested, because i never use a helper like that). PHP Code: <?php echo anchor("main/confirmSent/$r->Submitted", 'Mark Sent', array(
Thanks, it almost works, I just cant seem to get the your_link part right.
Ive tried <?php echo anchor("main/confirmSent/$r->Submitted", 'Mark Sent', array( 'class' => 'button icon approve', 'onclick' => "if (confirm('Are you sure you want to mark as sent?')) { location.href = 'main/confirmSent/$r->Submitted'; } return false;" )); ?> and <?php echo anchor("main/confirmSent/$r->Submitted", 'Mark Sent', array( 'class' => 'button icon approve', 'onclick' => "if (confirm('Are you sure you want to mark as sent?')) { location.href = 'achnor(\"main/confirmSent/$r->Submitted\")'; } return false;" )); ?> the first one brings up the confirmation dialogue but doesnt go to the right place, the second goes to the right place but the dialogue doesnt come up. Thanks again
try this
PHP Code: <?php echo anchor('main/confirmSent/'.$r->Submitted, 'Mark Sent', array(
It returns ...
A Database Error Occurred Error Number: 1054 Unknown column 'main' in 'where clause'
You must have an error in your update query .. it searches for an column main that isn't in your table. maybe you have to set the link in the javascript with as slash .... location.href = '/main
|
Welcome Guest, Not a member yet? Register Sign In |