Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #101729

    Hi, I’m looking for a way to add a custom click event handler to a button controlType. Like:
    new Smart.Form(#form, {
    controls: [
    controlType: ‘button’,
    label: ‘Button’,
    action: () => {
    Is that or something similar possible?


    Hi david,
    Unfortunately if you want to add a custom event handler to a button in Smart.Form there is another approach.
    I want to give you an example on how to achieve this by having made a code snippet for you.
    //In your JS file

        const smartForm = document.querySelector('form')
        let ctrlButton = smartForm.querySelector('smart-button[role="button"]')
        ctrlButton.addEventListener('click', ()=>{
            console.log('Your function')

    Let me know if that works for you.
    Please, do not hesitate to contact us if you have any additional questions.
    Best regards,
    Yavor Dashev
    Smart UI Team

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.