• kenl

    (@analogmanorg)


    Hi,
    I am trying to capture the value of a caldera form field and use that value to change the name of a file that I am uploading. I am not a programmer or developer. but love to learn.

    /** GET value of field in caldera form */
    add_action( ‘caldera_forms_entry_saved’, function( $entryid, $new_entry, $form ){
    //get value of field with ID fld_9255683
    $value = Caldera_Forms::get_field_data( ‘fld_9255683’, $form, $entryid );

    $GLOBALS[‘justorder_referencekpl’] = $value;

    },5 );

    /** EXAMPLE FROU */
    add_filter( ‘frou_sanitize_file_name’, function($filename_infs){

    global $justorder_referencekpl;

    $filename_infs[‘structure’][‘translation’][‘preflex_rule’] = $justorder_referencekpl ;
    return $filename_infs;
    }, 20 );

    Any suggestions.
    Thanks,
    ken

Viewing 1 replies (of 1 total)
  • Plugin Author Pablo Pacheco

    (@karzin)

    Hello, I don’t like using globals, but once you mentioned I think it should be a bit different:

    /** GET value of field in caldera form */
    add_action( 'caldera_forms_entry_saved', function( $entryid, $new_entry, $form ){
    $value = Caldera_Forms::get_field_data( 'fld_9255683', $form, $entryid );
    global $justorder_referencekpl;
    $justorder_referencekpl = $value;
    },5 );
    /** EXAMPLE FROU */
    add_filter( 'frou_sanitize_file_name', function($filename_infs){
    global $justorder_referencekpl;
    $filename_infs['structure']['translation']['preflex_rule'] = $justorder_referencekpl;
    return $filename_infs;
    }, 20 );

    Some notes:

    • I’ve never used caldera form
    • I didn’t test this piece of code

    But tell me if it works or if you had any luck 🙂
    See you

Viewing 1 replies (of 1 total)
  • The topic ‘Question about form field values’ is closed to new replies.