Re: [solved]onclick support patch to Pager by Robert Freund

From: Date: Thu, 19 Jul 2007 16:49:29 +0000
Subject: Re: [solved]onclick support patch to Pager by Robert Freund
References: 1 2 3 4 5 6  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-27696@lists.php.net to get a copy of this message
Massimiliano Arione schrieb:
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.
'fileName'=>'#' or better: 'fileName'=>'javascript: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".

« previous php.pear.general (#27696) next »