All elections by the people shall be by ballot. Every ballot shall be numbered in the order in which it shall be received, and the number recorded by the election officers on the list of voters opposite the name of the elector who presents the ballot. The election officer shall be sworn or affirmed not to disclose how any elector shall have voted, unless required to do so as witnesses in a judicial proceeding, or a proceeding to contest an election.