For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > July 2007 > Re: [PEAR] 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] onclick support patch to Pager by Robert Freund
Massimiliano Arione

2007-07-19, 8:02 am

Leo Márquez wrote:
> I'm trying to use Pear::Pager with Robert Freund onclick support patch
> applied.
> But it don't work to me. I have doubts on how I have to use the onclick
> method.
> I have a javascript function that works if I do a simple html onclick.
> In Pager I have:
> 'fileName' => '/?page=%d', <---- ????
> 'onclick' =>
> 'xajax_getAgendes('.$filtres['idfitxa'].','.$filtres['idplana'].',%d)',
> 'append' => false
> I must combine fileName with onclick? I can't use only 'onclick'?
> The html output I want is:
> onclick="xajax_getAgendes(286,23,2);"
> The result I have obtaining now is links that change my url and submit
> the link, not execute the javascript funcion in tha same page.
> I hope you understand my problem. Sorry about my english.


I use javascript links with Pager without any patch. Options:
'path' => '',
'append' => false,
'fileName' => 'java script:myJsFunction(myParameter1,my
Parameter2,%d)',

--
Massimiliano Arione

http://garakkio.altervista.org
Leo Márquez

2007-07-19, 8:02 am

Thanks for your answer Massimiliano,

I was tried the method you say before and not works for me.
In my html I need to do ajax calls. This one works perfectly:

<span onclick="xajax_Agendes(a,b,c);">

But this one not (writed by hand, not generated with pager):

<a href="java script:xajax_Agendes(a,b,c);">click here</a>

Not work because this link changes my page and I see the 'true' word in
all blank screen.

This is the reason I tried it with onclick patch.
It seems that the <a> tag disables my ajax functionality.

Thanks.

En/na Massimiliano Arione ha escrit:
> Leo Márquez wrote:
>
> I use javascript links with Pager without any patch. Options:
> 'path' => '',
> 'append' => false,
> 'fileName' => 'java script:myJsFunction(myParameter1,my
Parameter2,%d)',
>



--
Leo Márquez
[ Calidae - www.calidae.com ]
Markus Ernst

2007-07-19, 8:02 am

Leo Márquez schrieb:
> Thanks for your answer Massimiliano,
>
> I was tried the method you say before and not works for me.
> In my html I need to do ajax calls. This one works perfectly:
>
> <span onclick="xajax_Agendes(a,b,c);">
>
> But this one not (writed by hand, not generated with pager):
>
> <a href="java script:xajax_Agendes(a,b,c);">click here</a>
>
> Not work because this link changes my page and I see the 'true' word in
> all blank screen.
>
> This is the reason I tried it with onclick patch.
> It seems that the <a> tag disables my ajax functionality.


To me this looks like the xajax_Agendes(a,b,c) function returns true, so
the browser tries to resolve this return value as the value of the href
attribute.

AFAICS you either have to change the JS function the way it does not
return anything, or go for an onClick solution (as you actually try to
do). I don't think there is a solution with the href="java script:..."
syntax and a return value; anyway you might get more advice on this in a
JS group.

HTH
Markus
Massimiliano Arione

2007-07-19, 7:03 pm

Leo Márquez wrote:
> Thanks for your answer Massimiliano,
> I was tried the method you say before and not works for me.
> In my html I need to do ajax calls. This one works perfectly:
> <span onclick="xajax_Agendes(a,b,c);">
> But this one not (writed by hand, not generated with pager):
> <a href="java script:xajax_Agendes(a,b,c);">click here</a>
> Not work because this link changes my page and I see the 'true' word in
> all blank screen.
> This is the reason I tried it with onclick patch.
> It seems that the <a> tag disables my ajax functionality.


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/

--
Massimiliano Arione

http://garakkio.altervista.org
Sponsored Links







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

Copyright 2008 codecomments.com