Confused about how to achieve form function