3

目的 次の関数は、変数を使用して、フォームの非表示フィールド ( hidden_
​​email...) に事前入力する必要があります。


疑い フィールドに渡す必要がある変数 "$cust_email" は、ページの読み込み中に既に宣言されています。そして現時点では、メールアドレスが含まれています。

現在の結果
問題は、以下のコードを実行すると、変数がすでに空になっているように見えることです。フォームのフィールドには何も渡されていません。

function create_page() {

    $cust_email = $json->emailAddress;


function ninja_forms_handler() {
    add_action ( 'ninja_forms_pre_process', 'add_customers_email' );
}
add_action( 'init', 'ninja_forms_handler' );

function add_customers_email() {
    global $ninja_forms_processing; 

    $form_id = $ninja_forms_processing->get_form_ID();  
    if( $form_id == 3 ){     
        $ninja_forms_processing->update_field_settings( ‘hidden_email_1488454108179’, $cust_email );
    }     
  }
}
4

2 に答える 2