Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • in reply to: Cannot submit front-end from embedded within an iframe #21445
    PrzemekPrzemek
    Participant

    Hello,

    Thank you for looking at this.

    The page (being within an iframe; let's call it "primary" page) with form tries to create PHPSESSID cookie when opened on "secondary" page. As for now it works in Firefox, doesn't work in Chrome (session, when https, should be started with params: 'Secure' => 1 'SameSite' => 'None') and doesn't work in Safari (is blocking third party cookies like this one PHPSESSID by default).

    As the form submission relies on this session cookie, I think nothing can be done to override Safari policy here.

    in reply to: Cannot submit front-end from embedded within an iframe #21432
    PrzemekPrzemek
    Participant

    After investigation I found that the issue is caused by the fact that MBFS form page loading in iframe tries to set up PHP session cookie. It could be secure cookie under https - then it would be solvable in Chrome - but Safari blocks all 3-party cookies by default anyway.

    I don't know if MBFS really, really needs this session cookie, however, this makes my setup impossible to implement with MB causing me to be very sad...

    in reply to: Cannot submit front-end from embedded within an iframe #21398
    PrzemekPrzemek
    Participant

    Did you test with a non-Ajax form as well?

    I can for example add comment to the host site but I cannot submit MBFS form. It just reloads.

    in reply to: Cannot submit front-end from embedded within an iframe #21388
    PrzemekPrzemek
    Participant

    Hello!

    Thank you for your testing.

    Actually, I should have check it and mention that the iframe embedded on the host site works for me as well.

    However, the story is about the iframes embedded under different domains than that where MB is installed. (Perhaps it should be something different than "localhost" to reproduce the case; I use 2 domains in Local by Flywheel app like primary-site.local and secondary-site.local.

    in reply to: Cannot submit front-end from embedded within an iframe #21378
    PrzemekPrzemek
    Participant

    By the way, I'm using Metabox All in One and it claims about the missing CSS file:

    https://(...)/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-frontend-submission/assets/css/frontend-submission.css?ver=2.0.0

    in reply to: How to create a block that supports inner blocks? #19745
    PrzemekPrzemek
    Participant

    It would be great to see this feature in MB, especially as ACF has just announced it for 5.9 update. They are going to parse <InnerBlocks /> component in PHP template.

    in reply to: No validation in Ajax front-end submission #18402
    PrzemekPrzemek
    Participant

    Hello, thank you for taking a look at that.

    So far I'm using a workaround to keep MB Builder and validations together.

    1. I disabled Ajax for front-end forms
    2. I added a filter which modifies existing meta boxes by inserting validation formulas
    add_filter( 'rwmb_meta_boxes', 'prefix_meta_boxes_validation_rules', 999 );
    /**
     * Add validation rules to existing meta boxes.
     *
     * Filter hook: 'rwmb_meta_boxes'
     *
     * @since 1.0.0
     *
     * @param array $meta_boxes Meta Box plugin's meta boxes.
     */
    function prefix_meta_boxes_validation_rules( $meta_boxes ) {
    
        foreach ( $meta_boxes as $i => $meta_box ) :
            $required = [];
            foreach ( $meta_box['fields'] as $field ) :
                if ( isset( $field['required'] ) && $field['required'] ) :
                    $required[] = [ $field['id'] => [ 'required' => 1 ] ];
                endif;
            endforeach;
            if ( ! empty( $required ) ) :
                $meta_boxes[$i]['validation'] = [ 'rules' => $required ];
            endif;
        endforeach;
    
        return $meta_boxes;
    }
    in reply to: No validation in Ajax front-end submission #18389
    PrzemekPrzemek
    Participant

    Some additional observations.
    Safari, Chrome, WP 5.3.2, TwentyTwenty theme

    When I defined the fields in PHP instead of MB Builder with 'validation' attribute like below:

         'validation' => array(
                'rules'  => array(
                    $prefix . 'first-name' => array(
                        'required'  => 1,
                    ),
                    $prefix . 'last-name' => array(
                        'required'  => 1,
                    ),
                ),
            )
    1. Validation errors are properly visible in non-Ajax submit
    2. Validation errors are replaced with success message in Ajax submit
    3. In both cases the fields labels have duplicated asterisk marking required fields "* *"
    4. When I don't use 'validation' attribute and rely just on browser's validation, the submit field remains "disabled" when I fill the fields after initial submit attempt and cannot be re-submitted (non-Ajax form)

    I'm sad a bit as I wanted to use all this stuff on production without installing third-party plugins...

    in reply to: Save meta values in database #17602
    PrzemekPrzemek
    Participant

    I'm not familiar with MB Block internals, but in pure Gutenberg there are just 2 steps: registering post meta in PHP and defining "source: 'meta', meta: 'meta_field_key'" in JS block declaration. I feel that it might be not a big leap in MB code.

    in reply to: Save meta values in database #17594
    PrzemekPrzemek
    Participant

    If one field in each blog has different values, then there’s no way to decide which value will be save in the post meta.

    Anh, I understand your point, but the fact is that blocks are created by aware developers and Gutenberg itself gives the possibility of storing data in post meta. (For example, it is enough to allow one such block per post and potential confusion is over)
    I think there are many use cases for this.
    An instant example from me five minutes ago: I want to create a block including editable featured image and it would be great if this advice would work in MB Blocks: https://support.metabox.io/topic/adding-fields-to-featured-image-metabox/

    PrzemekPrzemek
    Participant

    Such small while so useful!
    Thank you!

    PrzemekPrzemek
    Participant

    That's great! Thank you.

    PrzemekPrzemek
    Participant

    I just had clients recently who needed to fill a large number of inputs within multiple blocks across many posts and they didn't want to click edit every single time.

    Also, I have some blocks that do not render anything interesting but store important data.

    in reply to: Creating Gutenberg sidebar panels #17472
    PrzemekPrzemek
    Participant

    Hi, I'm not sure if ACF can do it. Is it documented?
    I mean exactly sidebar panels (Gutenberg-based), not just meta boxes aside.

    in reply to: Creating Gutenberg sidebar panels #17106
    PrzemekPrzemek
    Participant

    Thank you Anh, there are so few tools that make it easy, that it could be a very valuable feature of your plugin.

Viewing 15 posts - 1 through 15 (of 15 total)