As I needed a read only field with the calculated value I've solved this issue using gform_field_input
- Works fine but some feedback on the method would be appreciated! Also I get a html break between the field label and the input box after returning the $input. Can't seem to find were this is generated. Anyway, gravity forms did the trick! Like it.
functions.php in theme:
add_action("gform_field_input", "field_updater", 10, 5);
function field_updater($input, $field, $value, $lead_id, $form_id)
{
// change text field to read only and set value only for field 14 and pagenumber 2.
if ($field['id'] == 14 && $field['pageNumber'] == 2 )
{
$calculation = do_shortcode('[=calculate_me value1="'.$_POST['input_1'].'" value2="'.$_POST['input_2'].'" value3="'.$_POST['input_3'].'"]');
$input = '<input READONLY type="text" tabindex="12" class="large" value="'.$calculation.'" id="input_2_14" name="input_14">';
return $input;
}
Posted 12 years ago on Monday May 7, 2012 |
Permalink