zfdatagrid / grid

A DataGrid library for Zend Framework
BSD 3-Clause "New" or "Revised" License
10 stars 16 forks source link

can i in (crud.before_insert) callback - set form field value so that it reflect the changes in table after insert #110

Closed imonteiro closed 11 years ago

imonteiro commented 11 years ago

Original author: aj.jaini...@gmail.com (February 08, 2012 20:06:59)

What steps will reproduce the problem?

1.$feeupdategrid->listenEvent('crud.before_insert',array($this,'feeUpdateCallback'));

public function feeUpdateCallback(Bvb_Grid_Event $event){ $params = $event->getParams(); $subject= $event->getSubject();

$previousDues = $params['values']['previousDues']; $tuitionfee = $params['values']['tuitionfee']; $grandTotal = $params['values']['grandTotal'];

$updatedAmount =intval($previousDues)+intval($tuitionfee); -working till here

//$subject->getForm(1)->getElement('grandTotal')->setValue($updatedAmount); -- not working

//$dateFieldName = $subject->getParam('grandTotal'); -- not working //$subject->setParam('grandTotal',$updatedAmount); -- not working }

2.i am able to access the form field using $params['values']['--'] but unable to set the values .

  1. because i want to change value of another field before saving it into the table .

Is it possible or i might be doing something wrong . new to zend and zfdatagrid . any advice is good .thanks

Please insert the appropriate values; Zend Framework version: VERSION = '1.11.9' ZFDatgrid Version (Bvb_Grid::getVersion()): VERSION = '$Rev: 1868 $'; Operating system:windows 7 PHP Version:5.3 Database Server and version:mysql Source Adatapter:

Please provide any additional information below.

Original issue: http://code.google.com/p/zfdatagrid/issues/detail?id=821

imonteiro commented 11 years ago

From ivomonte...@gmail.com on February 09, 2012 09:24:11 Hi,

I didn't confirm, but try this:

$event->setParam('grandTotal',$updatedAmount);

IM