Add javascript functions for the form