Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Does anyone know how to add two fields together?
I have tried looking through documentation but everything I used just comes back with 'undefined variable'.
I basically just want to add:
field 1 (which is a numerical value)
to
field 2 (which is a numerical value)
and display that in my computed field.
Comments
Comment #1
Rix-1 CreditAttribution: Rix-1 commentedOk it was my display output that was causing problems....
if it helps anyone else:
$display_output = $entity_field_item['value'];
Comment #2
Rix-1 CreditAttribution: Rix-1 commentedOk not that simple after all.
I need to add:
field 1 (which is a numerical value field on the node)
to
field 2 (which is a numerical value field from a taxonomy term custom field - the term is attached to the node)
Any ideas?
Comment #3
zkent CreditAttribution: zkent commented$values['payment_amount'][0] = $values['quantity'][0] * $values['cost'][0];
where 'payment_amount' is a textfield on page 2 of the multi-page webform
'payment_amount' is also where the macro code (above) lives
'quantity' is a number field on page 1
'cost' is a hidden field on page 1