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



I am posting this issue after searching through all the threads of form submissions.

My scenario is, Our HubSpot form is hidden on the page and We are showing a custom form to the users. Users fill the custom form and we then put all the user submitted values to hidden HubSpot form and submit the form via the trigger. It was working perfectly until a couple of months ago but things got changed at HubSpot end and We are stuck :frowning:

Error appear on trigger is

looking forward

Cannot read property 'target' of undefined from v2.js
Hubspot form: programmatically set field value via jQuery

I found something very strange.

When I apply .change() on email field. It triggers this error, otherwise on all the other fields .change() works.

$("#hubspot-form form input[name='email']").val('').change();


Hi @Muhammad_Adnan,

Is this currently working? Embedded forms have some frontend validation for the email field, which might be triggered when you update the email field with the value from your external form.

I also wanted to recommend a simpler method; you can submit to the HubSpot Forms API using the new AJAX endpoint instead of embedding/hiding a form on the page:


Hey @Derek_Gervais

Yea I think the new AJAX method is much better way but I was just getting curious that why It is only happening with the email field. I am even applying .change() after updating the email field form my form.


What can be the work around for email validation?

$("#hubspot-form form input[type='email']").val(;


Hi @Muhammad_Adnan,

I'm not able to reproduce this with a form in my own portal, so it might be something specific to your setup. Can you send me a link to the page you're working on?



Can you share your form with me?
here is my page link


Hi @Muhammad_Adnan,

Sure thing; here's a super simple test page I set up in my portal:

I checked out your page, and from what I can see the form isn't an embedded HubSpot form. I generally populate the email field with code like this:


The code you included above is different, but theoretically should work. I think the issue is that your selector includes HubSpot form markup that doesn't appear in the DOM. Trying the following in the console worked for me:



I got it solved, The real problem was I was using

whereas It should be

So, the problem solved for me.


Hello @Derek_Gervais, @Muhammad_Adnan

I have same issue "Cannot read property ‘target’ of undefined from v2.js". i am using hubspot form module and fill data from external html form.

There is issue with email field only.

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

We are facing the same problem and are using the v2.js... Any solutions so far

Code invoked ...

The bold part seems to be the problem ... ( the email object has the correct email address value ).

The error returned is ...
v2.js:formatted:14112 Uncaught TypeError: Cannot read property 'target' of undefined


I'm also experiencing the same problem using Hubspot's recommended method of introducing a change event
portalId: "xxxxxxx",
formId: "xxxxxxx-xxxxxxx-xxxxxx-xxxxxx",
onFormReady($form) {
And return the error Uncaught TypeError: Cannot read property 'target' of undefined

Some HS developer support would be appreciated, as many people seem to be experiencing this same issue.


@TIDEV, @sreece - reached out internally to the forms team to get clarification on this error. Will update when I have more info


Any progress on this ... and guideline on when the fix will be in place


Hey @TIDEV, still waiting on the forms team for clarification on if this is a bug or not. For what it's worth, I was able to get the console error to clear if I provided a callback like this:

onFormReady: jQuery('input[name="email"]').val('').change(function(){
    console.log(this.val + " changed");

I'll update you when I get more info


Appreciate your help following up, I understand you were able to get the console error to clear, but as you mentioned it does not solve the purpose of making the callback back to Hubspot to take action on the email address change (which you are following up with Hubspot forms team) ….

If you see the API documentation , It clearly states in red note: If you are using jQuery to manipulate the values of form inputs (i.e. using val() or prop()), you must trigger a change event using change() or trigger('change') for the change to properly register.

The purpose behind this was to trigger the callback function to return resubscribeMessage “Looks like you've opted out of email communication. Click here to get an email and opt back in.”

The capability did work for a year, so hopefully it’s treated with priority.


Hi @TIDEV, yep - the team that owns forms is working on it currently. Appreciate your patience.


Hi @TIDEV et al., this issue should now be resolved. The forms team has addressed the issue and console errors should be cleared up.


Thank you Connor_Barley , appreciate your help investing this issue and following through with it to have it fixed.

The fix helped resolve forms callback issue that we were facing.


  •      Jaski