Solved

Form getting cleared on click or submit

  • 11 April 2022
  • 3 replies
  • 82 views

Badge

Hi!

I’m getting quite a strange issue atm with one of my forms, I have a multi step form so I store the values as variables via JS and set the values on the klaviyo form at the end of the process, thought the variables are set whenever I click on a field or the submit button it instantly removes all of the values, in the case of the submit button it deletes them and then tries to send the empty form (resulting in an error).

I’m not sure why it is that this happens, I believe it might have something to do with the “needsclick” class included in every piece of the form thought I’m not certain, has anyone stumbled across this issue? if so how can it be solved? 

icon

Best answer by joorch 12 April 2022, 21:09

View original

3 replies

Userlevel 7
Badge +58

Hello @joorch,

Welcome to the Klaviyo Community!

That’s an interesting behavior and use case you have going! 

I’d be curious to learn more about the setup you’re using. If i’m understanding your explanation correctly, it sounds like you may have some custom multi-step form setup collecting certain information that you’re attempting load and populate into a Klaviyo form? If this was the case, I may suggest working with your developer to investigate how the form is supposed to connect to Klaviyo further. 

Alternatively, since it sounds like there is some coding occurring already, I may recommend using a custom built form rather than trying to leverage a custom multi-step form that you are attempting to link to a Klaviyo built form. May just be easier to stick to all custom as you could customize its function more and should accomplish the same task. I’ve also included some resources that i think may be helpful if you were interested in this route:

 

I hope this helps!

David

Badge

Hello @joorch,

Welcome to the Klaviyo Community!

That’s an interesting behavior and use case you have going! 

I’d be curious to learn more about the setup you’re using. If i’m understanding your explanation correctly, it sounds like you may have some custom multi-step form setup collecting certain information that you’re attempting load and populate into a Klaviyo form? If this was the case, I may suggest working with your developer to investigate how the form is supposed to connect to Klaviyo further. 

Alternatively, since it sounds like there is some coding occurring already, I may recommend using a custom built form rather than trying to leverage a custom multi-step form that you are attempting to link to a Klaviyo built form. May just be easier to stick to all custom as you could customize its function more and should accomplish the same task. I’ve also included some resources that i think may be helpful if you were interested in this route:

 

I hope this helps!

David

I was using a Legacy signup form as an embedded form, what is happening is I have a slick slider with multiple inputs and selects, all of this values are stored as variables and at the end I use Javascript to add the values to the Klaviyo form which is in the last step only, so as is the klaviyo form is only the regular embedded form you’d use normally just instead of inputting all of the values I prefill the form with Javascript. The odd part comes when I click on any element of the form which resets the form entirely (inputs, submit button, etc.).

I’m not sure if there’s a solution for it but currently I just made a regular form and set the form action to send the values instead which works like a charm, but I’m quite confused as of what was happening with the regular form I tried before.

Badge

@joorch I had the same issue with form fields getting cleared on submissions, glad I found your post 😅. I’m trying now with the legacy form route, and am having some other issues regarding custom properties explained here. I was wondering if you could share a skeleton for the form that you created, that would be super helpful.

Reply