adding correct value to input field