Support Forum » User Profile

Forum Replies Created

Viewing 10 posts - 16 through 25 (of 25 total)
  • Author
    Posts
  • in reply to: autocomplete="off" option? #33025
    Stephen C.Stephen C.
    Participant

    Unfortunately, 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.

    in reply to: Some fields won't save when using Include/Exclude #32941
    Stephen C.Stephen C.
    Participant

    Just 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.

    Stephen C.Stephen C.
    Participant

    I 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.
    Stephen C.Stephen C.
    Participant

    When 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.

    in reply to: Redirect to newly created post? #32089
    Stephen C.Stephen C.
    Participant

    FYI: 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 );
    in reply to: Any ideas of how to add a Save as Draft option? #29193
    Stephen C.Stephen C.
    Participant

    Okay, 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".

    in reply to: Any ideas of how to add a Save as Draft option? #29191
    Stephen C.Stephen C.
    Participant

    Also, is there a way to only show a Meta Box if it's a new post or the post_status is "draft"?

    Stephen C.Stephen C.
    Participant

    Ah, 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.

    in reply to: Date format when editing existing post #28200
    Stephen C.Stephen C.
    Participant

    Okay, thanks. That's easy to do.

    Stephen C.Stephen C.
    Participant

    Thanks 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.

Viewing 10 posts - 16 through 25 (of 25 total)