return false; for ajax onclick events

Login or register to post comments
2 replies [Last post]
Offline
Joined: 08/25/2009

Hi,

I noticed today when tidying up a system I'm build that when I had AjaxControlAction in my datagrid that is quite far down a page that when you click the button the page will jump to the top.

This is because, as I'm sure you know, there is no return false; at the end of

<?php

return sprintf("qc.pA('%s', '%s', '%s', '%s', '%s');",
               
$objControl->Form->FormId, $objControl->ControlId, get_class($this->objEvent), addslashes($objControl->ActionParameter), $strWaitIconControlId);
?>

_actions.inc.php: line 142.

Is this likely to break anything else in the framework? Or is there another method I should use to stop the page jumping back to the top?

Kind regards,

Nick

Offline
Joined: 03/31/2008

If you want it to return false, you should also be tacking on a QTerminateAction to the control as well.

Offline
Joined: 08/25/2009

Awesome, thank you :D