Home › Forums › Front End PM PRO › Add fields to form?
- This topic has 8 replies, 2 voices, and was last updated 3 years, 11 months ago by tonlogicdevworks.
-
AuthorPosts
-
January 24, 2021 at 3:05 am #42307tonlogicdevworksParticipant
Hello! How do we add fields to this form? We need a Quote #, Job reference # fields.
Thanks!
https://www.shamimsplugins.com/docs/front-end-pm/shortcode/fep_shortcode_new_message_form/
January 24, 2021 at 11:56 pm #42316Shamim HasanKeymasterYou can follow https://www.shamimsplugins.com/support/topic/additional-message-field/#post-20346 (there checkbox is added, you can add any type of fields) change
newmessage
toshortcode-newmessage
January 25, 2021 at 10:59 pm #42335tonlogicdevworksParticipantwe have tried this but it is not working on the front end shortcode form…
add_filter( ‘fep_form_fields’, function( $fields ){
$fields[‘cus_fep_textbox1’] = [
‘type’ => ‘text’,
‘where’ => ‘shortcode-newmessage’,
‘priority’ => 22,
‘cb_label’ => ‘Quote #’,
];
return $fields;
});January 25, 2021 at 11:48 pm #42337tonlogicdevworksParticipantok we resolved the fields on the frontend form but the added fields do not appear in the message when sent.
add_filter( ‘fep_form_fields’, function( $fields ){
$fields[‘cus_fep_textbox1’] = [
‘type’ => ‘text’,
‘where’ => ‘shortcode-newmessage’,
‘priority’ => 12,
‘label’ => ‘Quote Number’,
];
return $fields;
});
add_filter( ‘fep_form_fields’, function( $fields ){
$fields[‘cus_fep_textbox2’] = [
‘type’ => ‘text’,
‘where’ => ‘shortcode-newmessage’,
‘priority’ => 13,
‘label’ => ‘Job Reference Number’,
];
return $fields;
});January 27, 2021 at 11:23 pm #42375Shamim HasanKeymasterYou will need to save and display that value as well. Please see that link. There are more 2 blocks of code there you need to add.
January 28, 2021 at 1:25 am #42381tonlogicdevworksParticipantStill stumped.
The field label “Quote Number” is not showing or coming through in a message…add_filter( ‘fep_form_fields’, function( $fields ){
$fields[‘cus_fep_textbox1’] = [
‘type’ => ‘text’,
‘where’ => ‘shortcode-newmessage’,
‘priority’ => 12,
‘cb_label’ => ‘Quote Number?’,
];
return $fields;
});add_action( ‘fep_action_message_after_send’, function( $message_id, $message, $new_message ){
if ( ! empty( $message[‘cus_fep_textbox1’] ) ) {
fep_add_meta( $message_id, ‘cus_fep_checkbox’, $message[‘cus_fep_textbox1’], true );
}
}, 10, 3);add_action( ‘fep_display_after_message’, function(){
if ( fep_get_meta( fep_get_the_id(), ‘cus_fep_textbox1’, true ) ) {
echo ‘Quote Number’;
}
});January 28, 2021 at 5:22 am #42383tonlogicdevworksParticipantWe have made progress! But how do we separate the fields in the message box? Meaning we would like each field to get its own line
add_filter( 'fep_form_fields', function( $fields ){ $fields['cus_fep_textbox1'] = [ 'type' => 'text', 'where' => 'shortcode-newmessage', 'priority' => 12, 'label' => 'Quote Number', ]; return $fields; }); add_action( 'fep_action_message_after_send', function( $message_id, $message, $new_message ){ if ( ! empty( $message['cus_fep_textbox1'] ) ) { fep_add_meta( $message_id, 'cus_fep_textbox1', $message['cus_fep_textbox1'], true ); } }, 10, 3); add_action( 'fep_display_after_message', function(){ if ( $cus_fep_textbox1 = fep_get_meta( fep_get_the_id(), 'cus_fep_textbox1', true ) ) { echo 'Quote Number: '; echo esc_html( $cus_fep_textbox1 ); } }); add_filter( 'fep_form_fields', function( $fields ){ $fields['cus_fep_textbox2'] = [ 'type' => 'text', 'where' => 'shortcode-newmessage', 'priority' => 13, 'label' => 'Job Reference #', ]; return $fields; }); add_action( 'fep_action_message_after_send', function( $message_id, $message, $new_message ){ if ( ! empty( $message['cus_fep_textbox2'] ) ) { fep_add_meta( $message_id, 'cus_fep_textbox2', $message['cus_fep_textbox2'], true ); } }, 10, 3); add_action( 'fep_display_after_message', function(){ if ( $cus_fep_textbox2 = fep_get_meta( fep_get_the_id(), 'cus_fep_textbox2', true ) ) { echo 'Job Reference #: '; echo esc_html( $cus_fep_textbox2 ); } });
January 29, 2021 at 8:18 pm #42396Shamim HasanKeymasterPlease use like
echo '<div>Quote Number: ' . esc_html( $cus_fep_textbox1 ) . '</div>';
January 30, 2021 at 12:09 am #42402tonlogicdevworksParticipantAwesome! Thanks!
-
AuthorPosts
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.