Why does my form keep collapsing and erasing data?