Skip to content

How to Execute JavaScript Function on Button Click in VueForm Builder Custom Element? #47

Answered by adamberecz
L150n asked this question in Questions
Discussion options

You must be logged in to vote

Here's an example how you can subscribe to element events when using schema:
(schema tab) https://vueform.com/docs/subscribing-to-events#subscribing-to-events-1

So the syntax is:

// builder.config.js

export default {
  element: {
    types: {
      alertbutton: {
        label: 'Alert button',
        category: 'static',
        rules: [],
        schema: {  
          buttonLabel: 'Alert',
          type: 'button',      
          onClick() {
            alert('Test')
          }
        },
        // ...
      }
    }
  }
}

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@L150n
Comment options

@adamberecz
Comment options

@L150n
Comment options

@adamberecz
Comment options

Answer selected by L150n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants