Fixed a validation bug for ForeignKeySearchInput

Currently when you enter an invalid (non-int or id of non-existing object) manually into ForeignKeySearchInput, the application would crash trying to display validation message. This pull request fixes the problem.