Add select field to form


Home Forums Front End PM PRO Add select field to form

This topic is: Resolved
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #44649
    hamed
    Participant

    Hi.

    I need add select field to my form.
    I use this code but form not display my options.

    add_filter( ‘fep_form_fields’, function( $fields ){
    $fields[‘cus_fep_textbox41’] = [
    ‘type’ => ‘select’,
    ‘where’ => ‘newmessage’,
    ‘options’ => ‘Sample1’,
    ‘priority’ => 12,
    ‘label’ => ‘Test’,
    ];
    return $fields;
    });

    add_action( ‘fep_action_message_after_send’, function( $message_id, $message, $new_message ){
    if ( ! empty( $message[‘cus_fep_textbox41’] ) ) {
    fep_add_meta( $message_id, ‘cus_fep_textbox41’, $message[‘cus_fep_textbox41’], true );
    }
    }, 10, 3);

    Can you help me?

    Attachments:
    You must be logged in to view attached files.
    #44653
    hamed
    Participant

    I found the solution.
    I am writing the solution here so that if anyone needs it, it can be used:

    add_filter( ‘fep_form_fields’, function( $fields ){
    $fields[‘cus_fep_textbox41’] = [
    ‘type’ => ‘select’,
    ‘where’ => ‘newmessage’,
    ‘priority’ => 12,
    ‘label’ => ‘Title’,
    ‘options’ => array(
    ‘test1’ => __( ‘Test1’),
    ‘test2’=> __( ‘Test2’),
    ),
    ];
    return $fields;
    });
    add_action( ‘fep_action_message_after_send’, function( $message_id, $message, $new_message ){
    if ( ! empty( $message[‘cus_fep_textbox41’] ) ) {
    fep_add_meta( $message_id, ‘cus_fep_textbox41’, $message[‘cus_fep_textbox41’], true );
    }
    }, 10, 3);
    add_action( ‘fep_display_after_message’, function(){
    if ( $cus_fep_textbox41 = fep_get_meta( fep_get_the_id(), ‘cus_fep_textbox41’, true ) ) {
    echo ‘<div>Ville : ‘; echo esc_html( $cus_fep_textbox41 ) . ‘</div>’;
    }
    });

Viewing 2 posts - 1 through 2 (of 2 total)

You need to purchase ‘Front End PM PRO’ to create topic in this support forum.

If you already purchased ‘Front End PM PRO’ please LOGIN.