Search code examples
htmlformshelperform-helpers

Simple HTML single password form


I will preface this question with, I am a newbie so go easy on me.

I am trying to create simple html form with a single password field.

What I like to happen is when you type in a password it take me you a website by the same name.

Example: you type in monkey, it would take you to monkey.html.

It sounds super easy but I am lost.


Solution

  • I could not find a duplicate so here is a form would give a 404 on a wrong password.

    <form onsubmit="location=this.password.value+'.html'; return false">
      <input type="password" name="password" />
    </form>
    

    The return false is to stop the form from submitting. I use inline JS because the issue is so simple it is not worth rolling out the unobtrusive script with e.preventDefault and all.