Custom theme singin with OTC

I need the OTC singin functionality but I can’t seem to make it work. Setting up magic link was simple but for OTC It just submits the email everytime. How do I tell it first submit the email to get the OTC and then submit the provided OTC. Do I need two forms?

I tried using the official code example and adjusting it to also include the OTC input field.

<form data-members-form="signin" data-members-otc="true">
  <input id="email" data-members-email type="email" required="true"/>
  <input id="OTC" data-members-otp type="number" maxlength="6"/>
  <button type="submit">Potrdi</button>
</form>

I’m handling the visibility using the CSS “display:none; / display:block;” in order to first show only the email input field and then only the code input field.