js/main: Update form on autocomplete suggestion

Issue #313.
Merge branch 'issue/313'