Trim values before editing