cancel
Showing results for 
Search instead for 
Did you mean: 

Webforms2 Building interactive forms using JS

Webforms2 Building interactive forms using JS

Dear All 

 

I am using mageme Webforms2 extension to build interactive custom forms. I need to use javascript to add interactivity to the forms' fields

 

For Example: i need to copy a field's value to another when a checkbox is checked. I was told to use the Form's Description to add the script:

<script>
    document.addEventListener("DOMContentLoaded", function(){
        function copyab(){
            document.querySelector('.fieldb').value = document.querySelector('.fielda').value;
        };
        document.querySelector('.operation input').addEventListener("click", copyab);
    })
</script>

It shows up in the executed form's page and the functionality isn't working.

 

Where do i need to put the JS?

how can i reach the form's source code to make more additions, like "collapse" and some more bootstrap functionality?

 

2 REPLIES 2

Re: Webforms2 Building interactive forms using JS

Hi @yma981,

 

Since that is a paid extension maybe you can ask the vendor for support to be able to customize or extended the extension without problems.

 

Re: Webforms2 Building interactive forms using JS

The extension is open source, the vendor was helpful to an extent, it relies extensively on Magento's events and structure. 

Any hint will do