In all general elections held in cities of the first class and second class and incorporated towns for the election of officials of these municipalities, no ballots shall be counted for any person whose name is written in thereon. Only votes cast for the regularly nominated, or otherwise qualified, candidates whose names are printed on the ballot as candidates in the election shall be counted by the judges and clerks.