I went through the code once again and after I took a little bit of perspective it turned out I've had yet another form tag wrapping the part of the code that I was working on.
Lesson learnt, always make user forms are not nested within each other.
In case anyone else stumble upon similar issues, I'm posting some errors I encountered: