#101730
yavordashew
Member

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
https://www.htmlelements.com/