BRIAN YU: Let's now take your edit distance algorithm
and bring it to the web.
You'll write an index.html, a form.
And here's what you have to do inside of this form.
Inside of the body block of index.html, you want to add-- in HTML form--
where that form will send a post request to the route/score.
Inside of the form, you want to let the user type in a string--
we'll call it string one--
and another string-- string two--
which they'll want to compare using the Edit Distance algorithm.
And finally, at the bottom of the form, you'll
want to have a button that lets users submit that form.
So what might index.html actually look like?
Well, index.html by default is going to look something like this,
where we first extend our layout.
And then, inside of our body block is where
we're going to contain all of the code for the HTML
that you'll write that will represent the form that users can then submit.
What will that form look like?
Well, it'll look something like this.
You'll use form tags to enclose all of the input fields that you'll need--
where users can type an input in order to submit the form--
and in particular, note the HTML attributes
that we needed to add into this form.
The action is /score, because that's the route to which we want to send this
data after the user submits their form.
And the method for sending this data is going
to be post, because the user is going to send a post request via the form.
Now, inside of that form, you'll need to have a number of input fields
that will be places where the users can type in the first string, and type
in the second string, for example.
You can use input tags inside of the form
in order to create those spaces for users to type in input.
Make sure each input tag has a name attribute so that the web application
knows which input field is which.
In particular, those names should be string1 for the first string,
and string2 for the second string.
Each input tag is also going to need a type attribute in order
to designate what type of information the user is going to enter
when they're filling out the form.
And in particular, if they're just typing in strings,
that type can be text.
Once you've done that, index.html will display a form where
users can type in one string, type in another string,
click a button to submit the form, and then be displayed with the best way
to turn one string into the other.