Search code examples
ajaxcoldfusioncfmlcfajaxproxy

Coldfusion automatically save data


Instead of the traditional Posting of forms (with a save button) to save data to a database using coldfusion. Is there a sensible way of having information saved as the user exits the field. Is this even good practice?


Solution

  • All you need to do is via JavaScript, assign a change event to every field, then define that the event will make an Ajax call to save the data in that particular field. You should need a single target URL that takes some primary key and the field name in question.

    What you really need to consider though, is the bandwidth required to support such a process. What is your current load? Concurrent users? Concurrent form usage?

    If you have 100 people filling out a 10 field form, you currently have 100 HTTP POST requests to deal with. Can you handle 1000 HTTP POST calls if every field saves on its own? What about 1000 people at a time? 10k? 100k? And larger forms, how many of those do you have?

    The functionality is fairly trivial to implement, what is not trivial is the potential impact on your infrastructure.