js error this.form is null when form not set to record in db