Add Item

HTML Form Processing: Add Item

.

Scenario

Add new item.

Text input fields only.

.

Requirements – what you need

All HTML Form processing tasks need some or all of the following:

  • View model class for the HTML Form that will be displayed
  • Manager method that delivers data needed for the form object
  • Controller method (for GET) that will prepare and send the form object
  • View source code
  • View model class for the data that the user submits
  • Manager method that processes the user data
  • Controller method (for POST) that will accept the user data

.

How To – list of tasks

Complete this list of tasks:

  1. If you need a view model class for the form, write it
  2. If you need a manager method to supply data for the form, write it
  3. Write the GET controller method
  4. Create and edit the view
  5. Write a view model class for the data that the user submits
  6. Write the manager method that processes the data
  7. Write the POST controller method

.

If you need a view model class for the form, write it

A simple HTML Form that displays empty text input controls probably does not need a view model.

If the form does need data, then write a view model class for the form. For example, you may want to display data that establishes a context for the form. Or, you may want to provide initial or suggested values for some of the text input fields.

The name of the view model class should use this format:
EntityNameAddForm

.

If you need a manager method to supply data for the form, write it

If the HTML Form needs data, simple data can be created in the controller method.

Alternatively, or if the data needs are more complex, write a manager method to supply the data.

.

Write the GET controller method

(more to come)

.

Create and edit the view

.

Write a view model class for the data that the user submits

.

Write the manager method that processes the data

.

Write the POST controller method

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: