I am researching about the right approach on how to implement data entry forms that change according to the data entry mode. Here's the situation:
Consider a parent-child form where you have a list of employees and a section to display employee details.
Clicking on an employee number from the list will cause the employee details to appear on the right-hand side of the screen using an HTML table.
The employee details will first appear as a read-only form. For example, the Country of Birth field would be displayed as 'SPAN' rather than a SELECT element.
When the user clicks the Edit button than the Country of Birth field is changed to a SELECT element containing a list of countries to choose from.
It is the behaviour of the ASP.NET FormView with ItemTemplate, EditItemTemplate and InsertItemTemplate that I would like to implement using jQuery.
In essence the data entry mode would be toggled by clicking buttons. I thought I would approach this requirement by using CSS rules for fields which would contain different DOM elements according to the data entry mode. As I mentioned earlier, if the mode is read-only show a SPAN otherwise show a dropdown element or textarea. Using jQuery I could toggle() between the different classes according to the data entry mode. Of course this would require two different types of elements for the same field.
Is this the best approach? I'm keen to hear from the experts. Thank you.