Modifications to commit 5f26af29, to make sure that we set error if the validation fails while submitting the URL before attaching it.