Migrated input restoration feature from functions.js to Chosen library