nf_field_checkbox_edit_sub_value

Edit submission value output function.

Description

nf_field_checkbox_edit_sub_value( $field_id, $user_value ); 

Parameters (2)

0. $field_id
The field id.
1. $user_value
The user value.

Usage

  1. if ( !function_exists( 'nf_field_checkbox_edit_sub_value' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/fields/checkbox.php'; 
  3.  
  4. // The field id. 
  5. $field_id = null; 
  6.  
  7. // The user value. 
  8. $user_value = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = nf_field_checkbox_edit_sub_value($field_id, $user_value); 
  12.  

Defined (1)

The function is defined in the following location(s).

/deprecated/includes/fields/checkbox.php  
  1. function nf_field_checkbox_edit_sub_value( $field_id, $user_value ) { 
  2.  
  3. if ( $user_value == 'checked' ) { 
  4. $checked = 'checked="checked"'; 
  5. } else { 
  6. $checked = ''; 
  7.  
  8. ?> 
  9. <input type="hidden" name="fields[<?php echo $field_id; ?>]" value="unchecked"> 
  10. <input type="checkbox" name="fields[<?php echo $field_id; ?>]" value="checked" <?php echo $checked; ?>> 
  11. <?php