Forum Replies Created
-
AuthorPosts
-
Stephen C.
ParticipantUnfortunately, using Javascript doesn't seem to work, because the browser fills in the form fields before the Javascript is run.
In case anyone else needs to do this, the solution is to add a hidden field with the id "autocomplete" and value "off" as the first field on the form. It has to be the first form field, though. You will also want to add 'save_field' => 'false' to prevent the field from being saved in the database.
Stephen C.
ParticipantJust an FYI: Using !is_admin() causes those fields not to be saved when submitting the form via ajax.
Using
if( wp_doing_ajax() || !is_admin() ) {seems to work, though.
December 7, 2021 at 5:26 AM in reply to: ✅Time field "Done" button doesn't update field if slider/select not moved #32469Stephen C.
ParticipantI ended up setting the beforeShow and onClose options along with adding an event listener (for the "Done" button), to make it function the way I want. Now, it functions this way:
- The time is only truly set when the "Done" button is clicked, which I have renamed to "Set" in the options.
- If the user doesn't move any selector inside the picker, it uses the default values of the selectors.
- I also added a close icon in the top corner, so the user can close the picker by either clicking outside the picker or by clicking the close icon.
- If they close the picker without clicking the "Done" button, the input box reverts back to its previous value.
- I added an "x" on the right inside the time field input box when there is a value, so the user can clear the field (the same way Select2 does).
- The time field input box uses a floating label.
- The picker uses a slide down animation effect (showAnim option) when opening and closing.
December 5, 2021 at 4:15 PM in reply to: ✅Time field "Done" button doesn't update field if slider/select not moved #32438Stephen C.
ParticipantWhen the timepicker opens, 12:00 am is populated in the select boxes. The sliders default to 00:00 which is also 12:00 am. This bug has been noted in the GitHub Issues for the Datetimepicker project by other users dating back years and the issue was never fixed.
Stephen C.
ParticipantFYI: This no longer works now that the frontend form is submitted via ajax. In order to redirect to the post, you need to do something like this:
// Redirect to the newly created post add_action( 'rwmb_frontend_after_process', function( $config, $post_id ) { $url = get_post_permalink( $post_id ); echo json_encode( array( 'success'=>true, 'data'=> array( 'message' => 'Your success message', 'redirect' => $url ) ) ); die; }, 10, 2 );Stephen C.
ParticipantOkay, I was able to use Include/Exclude to include the Meta Box only when it's a new post or the post_status is "draft".
Stephen C.
ParticipantAlso, is there a way to only show a Meta Box if it's a new post or the post_status is "draft"?
May 15, 2021 at 10:53 AM in reply to: ✅Latest AIO update broke something with FB Frontend Submission #28202Stephen C.
ParticipantAh, nevermind. I figured it out. I didn't include 'post_types'. As long as 'post_types' is defined on every meta box, everything works fine.
Thanks for your help.
Stephen C.
ParticipantOkay, thanks. That's easy to do.
May 15, 2021 at 4:55 AM in reply to: ✅Latest AIO update broke something with FB Frontend Submission #28199Stephen C.
ParticipantThanks for getting back to me. I updated the record I was working with from a different place and now the post_title and post_content are working fine. Not sure what the issue was, but it's working now.
The thumbnail is the only thing that still isn't working, though. Again, if I use post_fields in the shortcode, the thumbnail works. As a regular meta box, it doesn't work. Unfortunately, I have to use a regular meta box because I need the thumbnail upload/select to be at the bottom of the form and include a heading and description.
-
AuthorPosts