Cannot read property 'target' of undefined from v2.js


#1

Functionality failing and it was working for a year now...
Seems like a change introduced in v2.j, it's preventing Opt In link being returned from Hubspot based on our form integration and workflow with Hubspot.

To regenerate : use the following

hbspt.forms.create({
    portalId: "SamplePortalD",
    formId: "SampleFormID",
    onFormReady: function($form, ctx) {
        jQuery('input[name="email"]').attr('readonly', 'readonly').change();
        jQuery('input[name="email"]').val('sample@sample.com').**change();**
    }
});

Getting the following error ( on the last line change() call highlighted in bold )
v2.js:10 Uncaught TypeError: Cannot read property 'target' of undefined
at t.handleChange (v2.js:10)
at r.notifyAll (v2.js:1)
at i.close (v2.js:3)
at i.closeAll (v2.js:4)
at i.perform (v2.js:4)
at i.perform (v2.js:3)
at Object.S [as flushBatchedUpdates] (v2.js:3)
at r.closeAll (v2.js:4)
at r.perform (v2.js:4)
at Object.batchedUpdates (v2.js:2)

Re-posting, as I have commented the same on recent post/issue where similar issue reported.


#2

Hey @TIDEV, can you send over the page that this is happening on/ the original thread that you mentioned above? Thanks!


#4

#5

Thanks @TIDEV, can you send over the page that this this is happening on please? I won't be able to troubleshoot the issue without taking a look there. Please also send me your HubID! Thanks


#6

Thanks, it’s a secured page and requires an account, Have provided the sample script and portal details … HubSpot Ticket #2058382


#7

Thank you! Taking a look and will respond when I have an answer


#8

Hi @TIDEV, this should be resolved. I'm going to lock this topic, and we can correspond on this one: Cannot read property 'target' of undefined from current.js


#9