improve from_form method to ignore empty string as ID