I'm using ATK4 4.1.1 and have added a button to a page. I want this button to trigger an update to a database table when it is pressed and so have created code like this in a page.
$f=$p->add('Form',null,null,array('form_empty'))->setFormClass('horizontal bottom-padded');
$b1=$f->add('Button')->set('Finished');
$b1->js("click")->univ()->ajaxec($this->api->url(null, array("s"=>"D")));
$b1->js('click', $b1->js()->load(
$this->api->url(null,array('s'=>'D'))
) );
.. .. .. ..
if (isset($_GET['s'])) {
$ss=$this->add('Model_SprintStatus')
->loadBy(array('member_id'=>$p->api->auth->get('id')));
$new_status=$_GET['s'];
$ss->set('status',$new_status);
$ss->update();
}
When i access this page, it displays ok but when the button is clicked, i get an error saying method
BaseException
Method is not defined for this object
Additional information:
method: url
arguments: Array ( [0] => [1] => Array ( [s] => D )
I used an example from the following agiletoolkit.org section called Anatomy of a reload. As i got this error, i took the example and created a new page using the same code as the example and i get a similar error from that page as well.
BaseException
Method is not defined for this object
Additional information:
method: url
arguments: Array ( [0] => [1] => Array ( [side] => 1 [myajax] => 1 ) )
Besides trying the above ajaxec line, i also tried the following
$b1->js('click', $b1->js()->load( $this->api->url(null,array('s'=>'D'))));
and
$b1->js('click', $b1->js()->atk4_load( $this->api->url(null,array('s'=>'D'))));
but they also come back with the same error.
Maybe i've missed something or it's possible it's a change between ATK4 4.1.1 and 4.2 but i'm not in a position to upgrade at this time as trying to meet a deadline so what method do i have to execute this update from the button click in ATK 4.1.1
Thanks