diff --git a/_posts/2015-03-07-html-forms.md b/_posts/2015-03-07-html-forms.md index 7b6f952..e26809f 100644 --- a/_posts/2015-03-07-html-forms.md +++ b/_posts/2015-03-07-html-forms.md @@ -43,6 +43,31 @@ These controls use different HTML **tags**, but most of them use the `` t +### Control name and value + +We have omitted `name` and `value` attributes from most of the examples on this page so we can focus the the control itself. In a production website every **form control** that allows the user to provide input should have a `name` attribute, and depending on the control type, a `value` attribute as well. + +Here are two text inputs demonstrating this concept. The first has a name attribute and a default value assigned to the input, the second has only a name attribute: + +{% highlight html %} + + + + + +{% endhighlight %} + +If a user were to submit a form that contained these two inputs, without adding any additional data, a message similar to the followg would be sent to the server for processing: + +{% highlight json %} +{ + "subject": "Hello!", + "message": "" +} +{% endhighlight %} + +Please take a look at the [Dropdown menus](#dropdown-menus) and [Example: a complete signup form](#example-a-complete-signup-form) for an example of using `name` and `value` attributes with form controls. + ### The Form element The `
` is a block-level element thats defines an **interactive** part of a webpage. As a result, all form controls (like ``, `