Upon the hearing of such special proceedings, the court shall have the power and jurisdiction to examine and determine the legality and validity of, and approve and confirm or disapprove and disaffirm, each and all of the proceedings for the organization of such district under sections 31-727 to 31-762, from and including the petition for the organization of the district, and all other proceedings which may affect the legality or validity of the bonds and the order of the sale and the sale thereof. The court in inquiring into the regularity, legality, or correctness of such proceedings shall disregard an error, irregularity, or omission which does not affect the substantial rights of the parties to such special proceedings. It may approve and confirm such proceedings in part and disapprove and declare illegal or invalid other and subsequent parts of the proceedings. The court shall find and determine whether the notice of the filing of the petition has been duly given and published for the time and in the manner prescribed in section 31-757. The costs of the special proceedings may be allowed and apportioned between the parties in the discretion of the court. If the court shall determine the proceedings for the organization of the district and for the voting and issuing of the bonds legal and valid, the board of trustees or the administrator shall then prepare a written statement beginning with the filing of the petition for the organization of the district, including all subsequent proceedings for the organization of the district and voting and issuing of the bonds, and ending with the decree of the court finding the proceedings for the organization of the district and the proceedings for the voting and issuing of the bonds legal and valid. The written statement shall be certified under oath by the board of trustees or the administrator of the district.