I wouldn't be writing custom code for each form, I would be reusing the same code (cut & paste style) as often as possible, hence the reason I changed the code in my initial post, to that in my latter post!
Ok, some forms are going to require custom code, but the basics will remain the same...