Probably a pretty simple answer to this, but couldn't figure it out.
We've got a form in CCv6, where the user will enter values in multiple input boxes (ie L01, L02, L03, L04) within a form. We need to sum those values into one (ie M1) and send this as data within the same form.
We've got a form in CCv6, where the user will enter values in multiple input boxes (ie L01, L02, L03, L04) within a form. We need to sum those values into one (ie M1) and send this as data within the same form.
$M1 = $L01 + $L02 + $L03 + $L04How do we pass a variable (ie $M1) as input data in the form? Do we need to create a hidden input field (M1), but then how do we pass the variable $M1 into the field?
Any reason why you can't just accept the form inputs and sum them on submission? Any reason why you want them summed BEFORE submission?
How do you sum them on submission?
Tried putting M1:{data:L01} + {data:L02} +... in the save data function but obviously it didn't work.
Tried putting M1:{data:L01} + {data:L02} +... in the save data function but obviously it didn't work.
You can either rename the fields to L[0] L[1] etc etc and then use {data.sum:L} or use PHP
return $this->data("L01") + $this->data("L02") etc etcThen in save data action use {var:phpblockname}
This topic is locked and no more replies can be posted.