php - Ninja forms - checkbox checked-value issue. Is it possible to modify? Calculation not working -
i don't know if correct place ask, i'll try. have ongoing project wordpress (genesis framework - agentpress pro theme) working ninja forms, , having slight problem. web page is: http://www.supercastor.net/wordpress/listings/castellon-65-m2-ytong/
i have listings page (for each house model). each listing has metadata accessible via simple function genesis framework:
genesis_get_custom_field( 'custom_field_name' ); i have, link above has, list of checkboxes user can select/deselect, , total value calculated. working, except cannot assign value of "custom field" listing.
i using ninja forms, , after research, have come solution of registering custom field in nf:
function precio_basico_calc_display( $field_id, $data ){ // default_value if( isset( $data['default_value'] ) ){ $def_value_new = genesis_get_custom_field( '_listing_precio_sort' ); $data['default_value'] = $def_value_new; $default_value = $data['default_value']; debug_to_console("default_value set to:$default_value"); }else{ $default_value = ''; debug_to_console("default_value not set"); } $products_select = genesis_get_custom_field( '_listing_precio_sort' ); } // $products_select populated listing_price, output checkbox value of price. ?> <input type="checkbox" name="ninja_forms_field_<?php echo $field_id;?>" value="<?php echo $products_select;?>" checked="checked" class="ninja-forms-field ninja-forms-field-calc-listen" disabled="disabled"> <?php } i have small "debug_to_console" function, quick "debugging". can see value there, in calculation not set. have set default 40.000, should set value each price (in link example, should 19.000). as:
$products_select = genesis_get_custom_field( '_listing_precio_sort' ); and have tried following (field_id 33 checkbox in form):
add_filter( 'ninja_forms_field', 'my_filter_function', 10, 2 ); function my_filter_function( $data, $field_id ){ if( $field_id == 33 ){ $listing_price = genesis_get_custom_field( '_listing_precio_sort' ); $data['default_value'] = $listing_price; } return $data; } but isn't working either. mean, display value (in console), not making calculation correctly.
help! want calculation (total) update correctly each listing. thought changing default_value do, doesn't. i'm lost :(
thanks!
Comments
Post a Comment