giorgino
Posts: 2
|
Posted: 09/11/2014, 9:22 AM |
|
Hi,
I'm new to CodeCharge, and I've been fighting for two days with this problem:
I havbe an Editable Grid (created with the proper builder), which I use to insert data into a mysql table (the programming language is PHP). It has three fields:
- Price
- Fee
- Total
What I'd like to do, is to insert into the database table the "total" column as a sum of Price + Fee. I know I could do it easilywith a mysql trigger, but I do prefer to learn the CodeCharge way.
I managed to add (as a test) a "before submit" event with $gridname->Total->SetValue( 100 ) , and it's working (it does insert the 100 value in the DB). However, if I try something like
$gridname->Total->SetValue( $gridname->Price->GetValue() + $gridname->Fee->GetValue() ) , no value is inserted into the database table. What am I doing wrong ? I tried to place different custom codes almost everywhere, with no luck. I also tried the "custom insert" property, with no luck again.
Please note that, as of now, Price and Fee are "textbox", while Total is a "label". It's not necessary to have the total calculated realtime (javascript).
Thank you for your help!
Regards,
Giorgio
|
|
|
giorgino
Posts: 2
|
Posted: 09/12/2014, 2:47 AM |
|
finally I got it, looking ant the source PHP code. the right answer is:
$this->f210_fee->GetValue(true) + $this->f210_related_expenses->GetValue(true)
(I was missing the "true" parameter)
|
|
|
asadkhan
Posts: 1
|
Posted: 10/28/2014, 2:04 AM |
|
http://forums.yessoftware.com/posts.php?post_id=123479#
_________________
Asad Khan |
|
|
Waspman
Posts: 948
|
Posted: 10/31/2014, 12:12 PM |
|
You were right the first time, but total as a label was your problem.
_________________
http://www.waspmedia.co.uk |
|
|
|