You didn't mention if the input was DC or AC. The 7805 will only work with a DC input so if your 12V is AC you must rectify and filter it first.
In any case, you should always fit a capacitor across the regulator input and ground pins, as close as possible to the device itself. Manufacturers suggest different values but anything from about 1uF upward should be OK. It is advisable to add a second capacitor between the output and ground pins, again as close as possible but in most cases it isn't essential. If you leave the input capacitor off, there is a real danger of the 7805 oscillating by itself and it's output voltage would be completely unregulated. I have seen severe damage caused to equipment simply because one capacitor was left out!
Brian.