How can I conditionally end form?