CMS Development

bmabille
Participant

Progressive form: How to handle input value change by external JS ?

Hi !

 

I made a JS script in order to replace a city input by a select, with an autocomplete with zip input value. It's working well on simple form. 

But in progressive form i have some issues.

The value is correctly set in the input, but, some how, the value is reset when i submit the form (or, if i display the original city input, when i click on the input). I think Hubspot store the value in JS var, and didn't get notice of the input value change.

See below the render :

 

bmabille_0-1731687779827.png

 

And then the script in the select change :

 

 

           select.on("change",
                function() {
                    cityInput.attr('value', this.value);
                    cityInput.val(this.value);
                    cityInput.trigger('change');
                    cityInput[0].defaultValue = this.value;
                    cityInput[0].dispatchEvent(event);
                }
            );

 

 

Did you have an idea of how to get it work ?

0 Upvotes
3 Replies 3
bmabille
Participant

Progressive form: How to handle input value change by external JS ?

Hi @MrJustinGivens , yes, it in this specific form that my JS code didn't work.

0 Upvotes
MrJustinGivens
Top Contributor | Platinum Partner
Top Contributor | Platinum Partner

Progressive form: How to handle input value change by external JS ?

Yeah, I've also heard others say the same things. I think the forms team is currently working on making the new form js extendable. 

0 Upvotes
MrJustinGivens
Top Contributor | Platinum Partner
Top Contributor | Platinum Partner

Progressive form: How to handle input value change by external JS ?

@bmabille is this form using the New Form Editor with Steps?