Tuesday, December 4, 2012

Using .replaceWith() or .attr() in JsHelper::link ?

Hi,
I have a probably trivial question.

Can I put in cakephp JsHelper :: link options
other jQuery method, for example. replaceWith ()?

Clarification, on the admin page I have more links (twitter bootstrap buttons) on each individual record, one of the buttons should change when clicked.

Eg I need to change the following links

from

<a href="/admin/posts/publish/17/1" class="btn btn-warning" id="17">
<i class="icon-ban-circle"> </ i>
</ a>

to

<a href="/admin/posts/publish/17/0" class="btn btn-success" id="17">
<i class="icon-ok-circle"> </ i>
</ a>

With JsHelper :: link, 'update' option we can change the contents inside <a> </ a> tags, in this case it's <i> </ i> tags.

My JsHelper link:

<?php
echo $this->Js->link(
$this->Html->tag('i', '', array('class' => 'icon-ban-circle')), 
array(
'action' => 'publish',
$post['Post']['id'],
'1'),
array(
'class' => 'btn btn-warning',
'id' => $post['Post']['id'],
'update' => '#' . $post['Post']['id'],
'escape' => false),
false);
?>
http://pastebin.com/uDMjqdpN 

Thanks

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: