Adding javascript events is a much better way and should be prefered.  
But talking about the original problem again:

That should do the trick:

---
<?php echo link_to("Link Text", "#",  
array("onClick"=>"javascriptFunction(); return false;") ?>
---

A "href='#'" will be still generated, but because of the "return  
false" statement, the browser will not jump anywhere.

- Frank


Am 30.05.2009 um 12:37 schrieb Garakkio:

>
> You shouldn't use onlick attributes on links (nor on any other html
> element).
> Just make normal, then add javascript events (like onclick) using
> javascript itself.
> More info on http://en.wikipedia.org/wiki/Unobtrusive_JavaScript
>
> On May 29, 2:08 pm, Gareth McCumskey <[email protected]> wrote:
>> Hi there all,
>>
>> Without going into the specifics I am looking for a way to use:
>>
>> <?php echo link_to("Link Text", "#",
>> array("onClick"=>"javascriptFunction()") ?>
>>
>> in symfony without the page scrolling back up when the link is  
>> clicked. I
>> did find that you can use "javascript:" to do this but symfony  
>> complains
>> with this:
>>
>> An internal URI must contain a module and an action (module/action)
>> ("javascript:" given)., referer:
>>
>> I was wondering if anyone knows another way to do this to prevent  
>> the page
>> from scrolling back everytime a link is clicked. The reason for  
>> this is that
>> someone may have scrolled all teh way down a rather long page,  
>> clicked a
>> link and then has to re-scroll down again to find where they  
>> were ... not
>> that nice from a useability point of view.
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" 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/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to