Was passing DOM object instead of value. Fixed now.