Support

Account

Home Forums Gutenberg Javascript API for fields in block Edit mode

Unread

Javascript API for fields in block Edit mode

  • Hello,

    For many of our client we need to include custom fields validation through the ACF javascript API, which is great.

    We are now creating block with ACF and we are wondering if there are filters/actions in the API for fields in the edit mode of blocks.

    For example, we need to replicate the feature in which a field is autocompleted based on a field above it (exactly what happens when you create a field in the ACF gui, the Field name is auto populated according to the Field label field above).

    In normal ACF metabox, I would do with something like that

    
    acf.add_action( 'load_field/name=label', function() {
    
      // Bind change event
    
      // autopopulate the below field, previously targetted
    });
    

    But now as the fields are loaded through AJAX the above code would not work because it’s not ran when the block is selected and in edit mode.

    Is there any action/filter in the JS API that is related to the Blocks, when it is selected or change from preview/edit mode ?

    Thanks

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.