validateForm function in MPController