register function in the view