Recently for work, I’ve had cause to write functionality so that a certain chunk of a form can be inserted again, over and over, by the user. The form involves data about course equivalencies between schools, and the user might need to submit data for multiple courses a student has taken. Hence, the user needs to be able to add extra course sections on the fly, as they’re necessary.
- Should I have a separate page, containing the form fields written in plain HTML, that I dynamically insert into the form page via an AJAX call?
Contemplating the idea, I decided the best route would be to use AJAX. Here are some guidelines for making such a choice, based on the logic I used:
- Are you generating a lot of code?
legend’s, then several of those had the attributes
class, not to mention the normal attributes associated with
- Does the dynamically added code replicate content already in the main page?
- Are you adding only a small piece of HTML?
- If your dynamic content isn’t complex now, do you foresee it becoming so in the future?
- Are you using a PHP (or similar server-side language) back end?