For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > July 2007 > Re: [PEAR] [solved]onclick support patch to Pager by Robert Freund









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] [solved]onclick support patch to Pager by Robert Freund
Leo Márquez

2007-07-19, 7:03 pm

Hi,

Thanks all for your answer.
The problem is solved.
I have to combine the fileName and onclick options to don't execute the
href of the <a> tag. Then I configure pager with:

'path'=>'./',
'fileName'=>'/plana.php?idplana='.$filtres['idplana'].'#',
'onclick' =>
'xajax_getAgendes('.$filtres['idfitxa'].','.$filtres['idplana'].',%d)',

Filename is identical to my actual url with a final '#' character. So
the link is not executed and the page don't change.
Finally with the onclick event I execute my javascript/ajax function and
the result is as I expected.

Thanks again to all.

Leo

En/na Massimiliano Arione ha escrit:
> Leo Márquez wrote:
>
> I hope not to go off topic, since this is not a php/pear issue.
> You can resolve your javascript problem using a "cancelClick"
> function, like the one you can find in DOMhelp library
> http://icant.co.uk/sandbox/domhelp/
>



--
Leo Márquez
[ Calidae - www.calidae.com ]
Massimiliano Arione

2007-07-19, 7:03 pm

Leo Márquez wrote:
> Thanks all for your answer.
> The problem is solved.
> I have to combine the fileName and onclick options to don't execute the
> href of the <a> tag. Then I configure pager with:
> 'path'=>'./',
> 'fileName'=>'/plana.php?idplana='.$filtres['idplana'].'#',
> 'onclick' =>
> 'xajax_getAgendes('.$filtres['idfitxa'].','.$filtres['idplana'].',%d)',
> Filename is identical to my actual url with a final '#' character. So
> the link is not executed and the page don't change.
> Finally with the onclick event I execute my javascript/ajax function and
> the result is as I expected.


This is not a real solution, but just a workaround (ugly, in my opinion).
It only works if link points to the same page.

--
Massimiliano Arione

http://garakkio.altervista.org
Markus Ernst

2007-07-19, 7:03 pm

Massimiliano Arione schrieb:
> Leo Márquez wrote:
>
> This is not a real solution, but just a workaround (ugly, in my opinion).
> It only works if link points to the same page.
>


'fileName'=>'#'

or better:

'fileName'=>'java script:void(0)'

The best way would be of course to generate a page that replaces the
Ajax function in cases where Javascript is not available. This would
require something like:

'fileName'=>'/page/with/ajaxFunctionality.php?key=value&key2=value2'
'onclick'=>'ajax_function(arg1, arg2); return false;'

So, if JS is disabled, the page will be called, but if JS is available
the Ajax function is executed, and the click execution of the link is
stopped by "return false".
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com