SP programmers frequently develop Web apps that rely on displaying data within forms linked to a back-end database. To do this, you either create forms displaying data contained within a database, or display a form whose data you plan to place within a database when the form is submitted. In this column I'll share some useful form-building routines that will take some of the grunt work out of developing and maintaining those HTML forms.
Common Form-Building Tasks
When developing forms in ASP pages, there are usually a few tasks that get repeated for each control placed on the form. These include:
- Defining the control on the form
- Providing it a valid name tied to the back-end database
- Figuring out its appearance as well as maximum allowed data for entry
If you are using a visual editor such as FrontPage, Visual InterDev, Dreamweaver, or HomeSite to build your HTML form, you can drag and drop controls to create a form. However, these tools will not automatically generate the code needed to handle all the aspects above. You need to set the properties for each control individually to define its appearance, maximum data allowed, data validation, etc. There is a coding alternative to the above approach, especially suited for ASP programmers who do not use a visual tool.