Home › Forums › Front End PM PRO › Add a new field to form by typing the date
- This topic has 9 replies, 2 voices, and was last updated 3 years, 4 months ago by hamed.
- AuthorPosts
- July 11, 2022 at 12:36 am #44670hamedParticipant
When I try to add a new field to the form by typing the date, this field is not displayed.
Can you guide me how to do this?Attachments:You must be logged in to view attached files.July 13, 2022 at 11:02 pm #44684Shamim HasanKeymastertype
dateis not defined in this plugin by default. You can usefep_form_field_output_dateaction hook to output date field.July 16, 2022 at 1:12 pm #44699hamedParticipantDear Shamim,
Thank you very much for the help you give me.
To add the date selection field, I added the following code, but nothing is displayed.Can you tell me what I should change?
add_filter( ‘fep_form_field_output_date’, function( $fields ){
$fields[‘cus_fep_test’] = [
‘type’ => ‘date’,
‘where’ => ‘newmessage’,
‘priority’ => 12,
‘label’ => ‘Test’,
];
return $fields;
});add_action( ‘fep_action_message_after_send’, function( $message_id, $message, $new_message ){
if ( ! empty( $message[‘cus_fep_test’] ) ) {
fep_add_meta( $message_id, ‘cus_fep_test’, $message[‘cus_fep_test’], true );
}
}, 10, 3);add_action( ‘fep_display_after_message’, function(){
if ( $cus_fep_test = fep_get_meta( fep_get_the_id(), ‘cus_fep_test’, true ) ) {
echo ‘<div>Test : ‘; echo esc_html( $cus_fep_test ) . ‘</div>’;
}
});July 19, 2022 at 11:32 pm #44723Shamim HasanKeymasterYou need to echo from there. Like following (change as you require)
add_action( 'fep_form_field_output_date', function( $field, $errors ){ echo 'This is date field'; }, 10, 2);July 23, 2022 at 2:29 pm #44752hamedParticipantThis code only changes the text of the error message.
I want to create a new date type field where the user can specify a date.July 24, 2022 at 3:15 am #44755hamedParticipantI want to create a field like the attached image.
Attachments:You must be logged in to view attached files.July 25, 2022 at 6:43 pm #44765Shamim HasanKeymasterIt needs custom code. You can contact me using https://sp-test1.arogga.co/hire/ if you need code help.
July 25, 2022 at 11:30 pm #44771hamedParticipantI sent the message.
July 30, 2022 at 12:37 pm #44784Shamim HasanKeymasterPlease add following code in your theme’s (child theme’s if you are using) functions.php
add_action( 'fep_form_field_output_date', function( $field, $errors ){ printf( '<input type="%1$s" id="%2$s" class="%3$s" name="%4$s" placeholder="%5$s" value="%6$s" />', esc_attr( $field['type'] ), esc_attr( $field['id'] ), $field['class'], esc_attr( $field['name'] ), esc_attr( $field['placeholder'] ), esc_attr( $field['posted-value' ] ) ); }, 10, 2);July 30, 2022 at 5:12 pm #44785hamedParticipantthanks a lot.
you are amazing. - 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.