Navigation issue on form submission

Hi,

Just wanted to share with the rest.

I’ve implemented a form which was using “a href” to submit and it works fine.

However when I’ve changed this to a button instead of a href the form getting redirected itself to index page and can only be submitted for the second visit to the same form.

Please find sample code below (Not sure how to make the sample code appear in forum),

Works
Submit

Doesn’t work
Submit

Thanks.