Interesting, I'll have to check myself then if javascript in $html- >link works in the latest cake version too.
I'm using revision 7296. I know it is quite an old one. I could not find (or didn't know where to look for) info about this issue for the revision I use. On Sep 3, 4:46 am, "Dr. Loboto" <[email protected]> wrote: > But your example was about double quotes that is wrong INITIALLY. > > Btw, on my cakes there are no problems with single quotes in tags > attributes at all. What exact cake version do you have? > > On Sep 2, 3:48 pm, Kana <[email protected]> wrote: > > > > > Quoting myself: > > "I already mentioned trying both SINGLE quotes and DOUBLE quotes. Both > > result in escaped quotes, hence this post. " > > > I could have been more clear on where exactly I tried both double and > > single quotes :) > > > On Sep 2, 9:44 am, Kana <[email protected]> wrote: > > > > Hi there, thanks for your quick reply. > > > > I already mentioned trying both SINGLE quotes and DOUBLE quotes. Both > > > result in escaped quotes, hence this post. > > > > The example you gave results in: > > > > <a href="/image/a_link.php?test" class="image" > > > onClick="pageTracker._trackEvent('category', > > > 'action', 'label');"><img src="/img/an_image.jpg" / > > > > ></a> > > > > Is there something I am overlooking here? Is it justnotpossible to > > > haveJavascriptin $html->link() ? > > > > :) > > > > Kana > > > > On Sep 2, 4:03 am, "Dr. Loboto" <[email protected]> wrote: > > > > > Use SINGLE QUOTES when need quotes in tag attributes. It is the basics > > > > ofHTML. > > > > > <?php > > > > echo $html->link( > > > > $html->image('an_image.jpg'), > > > > '/image/a_link.php?test', > > > > array( > > > > 'class' => 'image', > > > > 'escape' => false, > > > > 'onClick' => "pageTracker._trackEvent('category', > > > > 'action', 'label');" > > > > ), > > > > false, > > > > false > > > > ); > > > > ?> > > > > > On Sep 2, 12:15 am, Kana <[email protected]> wrote: > > > > > > How tonotescapeJavascriptinhtmlhelperlinkwithout having to use > > > > >Javascriptoutside $html->link? > > > > > > I try to achieve: > > > > > - the quotes in the onClick event, either single or double quotes > > > > > > <a href="/image/a_link.php?test" class="image" > > > > > onClick="pageTracker._trackEvent("category", "action", "label");"> > > > > > <img src="/img/an_image.jpg" /> > > > > > </a> > > > > > > But the result I get when viewing pagesource is: > > > > > - note the escaped quotes > > > > > - I tried single and double quotes > > > > > > <a href="/image/a_link.php?test" class="image" > > > > > onClick="pageTracker._trackEvent("category", > > > > > "action", "label");"> > > > > > <img src="/img/an_image.jpg" /> > > > > > </a> > > > > > > I use the following code: > > > > > > <?php > > > > > echo $html->link( > > > > > $html->image('an_image.jpg'), > > > > > '/image/a_link.php?test', > > > > > array('class' => 'image', 'escape' => false, 'onClick' => > > > > > 'pageTracker._trackEvent("category", "action", "label");'), > > > > > false, > > > > > false > > > > > ); > > > > > ?> > > > > > > There must be a way to onClickJavascriptworking inlink? I Googled > > > > > but couldn't find any topic on this. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
