Forum Replies Created
-
AuthorPosts
-
Nicholas Cox
ParticipantHi, did this feature ever get implemented at all?
Nicholas Cox
ParticipantHi
Ok thanks, well I thought about using $attributes['id'] as it would work for my case; as its just for JS function purposes. It would be a useful if there was a way to pass the $attributes['id'] inside Javascript.
Thanks
Nicholas Cox
ParticipantHi Long,
Ah ok, that works now, thanks!!!
Nick
Nicholas Cox
ParticipantNicholas Cox
ParticipantHi Long,
Yes that is correct in regards to the save posts (data). I did not want to create a custom form ideally as Metabox already has the functionality and before and after form submission actions. So saves alot of dev work as i may need more forms in the near future.
I will try the deletion option. Thanks Long!
Nicholas Cox
ParticipantAlso if I wanted to prevent the form from creating a new post, can i just force the form to not validate? that way I can send the email and then then return the success message as a error validation?
no ideal but wondered if there was a better way. I do realise the metabox forms are not for this purpose.
March 5, 2022 at 6:37 PM in reply to: ✅Ajax form resubmission after failed validation (causes invalid error message) #34331Nicholas Cox
ParticipantHi
That would be great thanks! I am at a loss on what the issue is.
I have sent an email just now via the contact form with admin access and ftp details.
Thanks
Nick
Nicholas Cox
Participantalso as a note I have added a check in the following filter for is_admin() which has fixed the bulk delete error message issue for now.
add_filter( 'pre_delete_post', function( $null, $post, $force_delete ) { if( $force_delete == false ) { if ( ! is_admin() ) { return wp_trash_post( $post->ID ); } } return $null; }, 10, 3 );Nicholas Cox
ParticipantHi Long,
Ok I have added the ('save_field' => false) and the error does not display in the logs anymore. Thanks
I have made a note to add this in to all forms and a linkback to this thread.
It would be great if the custom post type trash option would work in the core of Metabox plugin
March 4, 2022 at 5:32 PM in reply to: ✅Ajax form resubmission after failed validation (causes invalid error message) #34305Nicholas Cox
ParticipantHi Long,
ok I have setup a staging website as I do not have a test environment.
So I have cloned my local setup (no website design yet as I'm just developing)
https://samsskip.co.uk/stg_155a6/with the following shortcode on the homepage
[mb_frontend_form id="dc-product" confirmation="Your post has been successful" ajax="true"]then if you enter the word 'test' into the input field and then retry, the form fails.
screen recording
https://drive.google.com/file/d/1iOypa0dYmMin2YMCgyOqSMJI9qfFeKiE/view?usp=sharingif you need access to files/login then let me know so I can send you this privately.
Nicholas Cox
Participantalso what i have also found another issue in relation to the following filter.
add_filter( 'pre_delete_post', function( $null, $post, $force_delete ) { if( $force_delete == false ) { return wp_trash_post( $post->ID ); } return $null; }, 10, 3 );When you go to bulk delete the custom post type in wp admin area there is an error which displays. The error is 'error in deleting item'. But you can delete them one by one.
video here...
https://drive.google.com/file/d/1AXFUcDvjz-5cGE84USvEWHCCVEu77thI/view?usp=sharingif I disable the filter above and then the bulk delete feature works.
Nicholas Cox
ParticipantHi
Ok i have removed the post_title field and can confirm that there is no error upon deletion.
So I have to create a duplicate database column to fix this issue? I just assumed that the post_title was automatically being populated in the post table.
March 3, 2022 at 4:58 PM in reply to: ✅Ajax form resubmission after failed validation (causes invalid error message) #34263Nicholas Cox
ParticipantI have done some screen recordings for you
If the form fails validation and then you resubmit the form, the invalid error message displays.
https://drive.google.com/file/d/1L6QiqZkXKsl70IdC_ajPM4TOk3mDXHxR/view?usp=sharing
If there are no validation errors the first time, the same form submits successfully.
https://drive.google.com/file/d/1moTAPLOdVy0X81NnXiqaOdgoIGr5Xjxe/view?usp=sharing
also to note, this does not happen when ajax is not enabled; as I assume the page refresh has something to do with it.
March 3, 2022 at 4:34 PM in reply to: ✅Ajax form resubmission after failed validation (causes invalid error message) #34261Nicholas Cox
ParticipantNicholas Cox
ParticipantHi Long,
sure, here is my code. Do you need anything else?
add_filter( 'rwmb_meta_boxes', 'dc_product_register_meta_boxes' ); function dc_product_register_meta_boxes( $meta_boxes ) { global $wpdb; $meta_boxes[] = [ 'title' => 'Products', 'post_types' => 'product', 'storage_type' => 'custom_table', 'table' => $wpdb->prefix . 'dc_products', 'id' => 'dc-product', 'context' => 'normal', 'fields' => [ [ 'type' => 'select', 'name' => 'Type', 'id' => 'type', 'options' => array( 'Gift' => 'Gift', 'Ask' => 'Ask', ), 'multiple' => false, 'placeholder' => "", 'select_all_none' => false, 'required' => true, ], [ 'type' => 'text', 'name' => 'Title', 'id' => 'post_title', 'class' => 'dc-post-title', 'limit' => 50, 'required' => true, ], [ 'type' => 'textarea', 'name' => 'Description', 'id' => 'description', 'required' => true, ], [ 'type' => 'dc_flatpickr_calendar', 'name' => 'End Date (optional)', 'id' => 'end_date', 'attributes' => [ //my custom attributes 'altInput' => true, 'altFormat' => 'd-m-Y H:i', 'inline' => false, 'allowInput' => false, 'disableMobile' => false, 'minDate' => 'today', 'enableTime' => true, 'time_24hr' => false, 'enableSeconds' => false, 'defaultHour' => 0, ], ], [ 'type' => 'select', 'name' => 'Condition', 'id' => 'condition', 'options' => array( 'used' => 'Used', 'like new' => 'Like New', 'new' => 'New', ), 'multiple' => false, 'placeholder' => "", 'select_all_none' => false, 'required' => true, ], [ 'type' => 'select', 'name' => 'Location', 'id' => 'location', 'options' => array( 'Hucknall' => 'Hucknall', ), 'multiple' => false, 'placeholder' => "", 'select_all_none' => false, 'required' => true, ], [ 'type' => 'dc_image_to_base64', 'name' => 'Images', 'id' => 'images', 'attributes' => [ 'max' => 6, //max of 10 files 'buttonlabel' => 'upload', 'maxWidth' => 300, //px 'maxHeight' => 300, //px 'description' => '(drag to reorder)', //'maxFileSize' => 8000000', //default wp upload size ], 'saveToCustomFolder' => [ 'enabled' => true, //enable folder save (default false) 'folder' => 'products', //foldername no slashes 'deleteOnUpdate' => true, //force deletetion ], 'required' => true, ], ], ]; return $meta_boxes; } -
AuthorPosts


