How easy is it to dynamically change the HTML control for a field?
This situation arose while I was building a prototype for a web-base survey application. A survey could have any number of questions, and the answer to each question could be one of the following: • Free format text – shown as a textarea 50 columns wide and 5 rows deep. • One of a number of pre-defined entries – shown as a dropdown list. • A number – shown as a text box with a size of 6 characters. This means that when building the HTML output for the screen I need to know what type of answer is expected so that I can generate the correct HTML tags. In some development infrastructures this may be a complex process, but in my infrastructure it is incredibly easy. This is made possible because of the following facets of my design: • No HTML tags are generated from within any PHP code – it is all done using XSL stylesheets. • I do not have a different stylesheet for each screen with the field names, field labels and field controls hard-coded – I use generic stylesheets where this informat