
297 N.W.2d 355 (1980)
Morris C. HURD, and Daniel D. Williamson, Appellants,
v.
Thomas C. ODGAARD, Wayne Swanger, Clifford Friedrichsen, and Helen Wanberg, Appellees.
No. 63135.
Supreme Court of Iowa.
October 15, 1980.
*356 Morris C. Hurd and Daniel D. Williamson, pro se.
Robert J. Belson, Holstein, for appellees.
Considered by REYNOLDSON, C. J., and LeGRAND, McCORMICK, McGIVERIN and SCHULTZ, JJ.
LeGRAND, Justice.
This is the second appeal involving this same controversy. In 1978 we annulled a writ of certiorari against the district court on the ground the plaintiffs had no standing to challenge the order of the judge providing for trials at places other than the courthouse. See Williamson v. District Court, 271 N.W.2d 727 (Iowa 1978). This mandamus action seeks to require the Ida County supervisors to repair the courthouse so that court business may again be transacted there. The trial court sustained defendants' motion for judgment on the pleadings, and plaintiffs appeal. We reverse and remand for further proceedings.
The history of this case goes back a number of years. It is conceded that the Ida County courthouse is in a state of disrepair and that some substantial corrective measures are necessary. Plaintiffs (who are practicing lawyers in Ida County) assert they are taxpayers and citizens of Ida County and that defendants should be compelled to comply with the requirements of the state fire marshal in order that the building be made safe for occupancy.
This appeal presents two questions: (1) the standing of plaintiffs to bring the action and (2) if successful on this issue, are they entitled to judgment on the pleadings.
I. Plaintiffs filed a motion for judgment on the pleadings, which was overruled. The order overruling pointedly suggested a similar motion by defendants would have been sustained. The defendants were quick to heed this advice and promptly filed their own motion for judgment on the pleadings. Plaintiffs appeal from the order sustaining that motion.
From the start this case has been in a state of confusion procedurally. The motion before us was filed pursuant to rule 222, R.Civ.P., the text of which is as follows:
Any party may, at any time, on motion, have any judgment to which he is entitled under the uncontroverted facts stated in all pleadings, or on any portion of his claim or defense which is not controverted, leaving the action to proceed as to any other matter of which such judgment does not dispose.
As the very name suggests, judgment on the pleadings, is appropriate only when the pleadings, taken alone, entitle a party to judgment. Evans v. Herbranson, 241 Iowa 268, 278-80, 41 N.W.2d 113, 117-18 (1950); State of Iowa ex rel. Freeman v. Carvey, 175 Iowa 344, 347-48, 154 N.W. 931, 933 (1916); A. Vestal and P. Willson, 1 Iowa Practice § 19.01 (1974).
Matters outside the pleadings should not be considered. Cf. Gigilos v. Stavropoulos, 204 N.W.2d 619, 622 (Iowa 1973) (if matters outside the pleadings are to be considered, motion should be made under rule 237, R.Civ.P. for summary judgment.) See 2A Moore's Federal Practice at 2201 et seq. (1979), discussing rule 12(c) F.R.Civ.P. The federal rule makes specific provision for this contingency, ours does not.
In the present appeal the parties presented, and the trial court apparently considered, evidence in the form of depositions as well as an earlier stipulation between the parties concerning repairs to be made. In City of Creston v. Center Milk Products Co., 243 Iowa 611, 616, 51 N.W.2d 463, 465 (1952), faced with a similar situation, we said rule 222 does not contemplate the introduction of evidence but held violation of the rule was not reversible error under the circumstances of that case. We again point out the proper function of a motion under rule 222 is simply to test the sufficiency of the pleadings to present an appropriate issue for trial.
*357 Nevertheless, as in City of Creston, we consider this appeal as presented by the parties and hold defendants were not entitled to judgment on the pleadings. We add gratuitously the result would be the same if we treated the motion as one for summary judgment under rule 237, R.Civ.P., because we conclude there are issues which cannot be resolved except by trial on the merits.
II. One of the vital issues raised is plaintiffs' right to maintain this mandamus action under section 661.9, The Code, which we set out:
The plaintiff in such action shall state his claim, and shall also state facts sufficient to constitute a cause for such claim, and shall also set forth that the plaintiff, if a private individual, is personally interested therein, and that he sustains and may sustain damage by the nonperformance of such duty, and that performance thereof has been demanded by him, and refused or neglected, and shall pray an order of mandamus commanding the defendant to fulfill such duty.
Defendants' argument is two-pronged. They allege plaintiffs have no standing as private citizens to compel the board to exercise purely discretionary powers; and they assert plaintiffs have shown no right to damages even if the standing issue is resolved in their favor. On the first point defendants rely heavily on Williamson v. Kelley, 271 N.W.2d at 730; for the second they cite Gabus Ford v. Highway Comm'n, 224 N.W.2d 639, 644 (Iowa 1974) and Hawbaker v. Highway Comm'n, 253 Iowa 573, 576-77, 113 N.W.2d 296, 298 (1962). We decide against defendants on both points.
Our opinion in Williamson v. Kelley was careful to reserve this very point for decision later. There we held only that practicing lawyers could not challenge a court order fixing the place where trials would be held. As recognized there, the duty of supervisors to provide and maintain safe and adequate court facilities is an entirely different matter.
Mandamus is a summary and extraordinary writ which should issue only in the exercise of sound judicial discretion, taking into account the interests of the public and of third persons, the nature and extent of the wrong or injury which would follow upon refusal of the writ, and the promotion of substantial justice. Headid v. Rodman, 179 N.W.2d 767, 770 (Iowa 1970) and citations.
The mandamus rule requiring one to plead and prove a right to damages does not apply to private persons who seek to enforce rights in which the public has a vital interest. In such circumstances, we have permitted the writ to issue without such a showing.
Cases which have allowed mandamus without a showing of pecuniary damages include Iowa Mutual Tornado Insurance Association v. Timmons, 252 Iowa 163, 176, 105 N.W.2d 209, 216 (1960), where we said:
The trial court rejected defendants' contention that plaintiff was not a proper party to bring this action, and defendants argue this issue in support of the correctness of the dismissal. The law on this view is not in doubt in Iowa. Plaintiff sued as a citizen, property owner and taxpayer, and pointed out in its petition that revenues from the premium tax involved go into the State general fund, which if insufficient to meet obligations of the State, must be supplemented by State levies upon property owners in the State. It also pointed out that if defendants prevail it will be prejudiced, and that the scheme used by the Farmers Mutual to avoid the two per cent premium tax, if permitted, will result in unfair discrimination in favor of it over plaintiff.
We in Iowa have never accepted the view expressed in several jurisdictions that the right of a taxpayer to vindicate the public interest in compliance with the laws of the State should be restricted only to those cases in which he could demonstrate pecuniary damage ....
In Claussen v. Perry, 248 Iowa 108, 114-17, 79 N.W.2d 778 (1956), we upheld the right of private citizens to compel an election for school district consolidation without a showing of personal damage.
*358 In Abbott v. Iowa City, 224 Iowa 698, 703, 277 N.W. 437, 439 (1938), which was an equitable action for an injunction, we said:
Appellees contend that, in order to maintain this suit [for a restraining order] appellants must show definite and certain legal damages suffered by them and that no such damages have been shown.
To authorize a contract for the construction or acquisition of a municipal light and power plant, an election on the proposition must first be had and the proposition be carried by a majority of the legal electors voting thereon. Without an election the fundamental right to enter into the contract does not exist. A holding that a citizen and taxpayer, or all the citizens in the city, cannot question the right of the city council to enter into such a vast undertaking as the construction of a municipal light and power plant, unless special personal damages are shown, would practically result in a situation where no one would have a right to question ... the council's illegal act in so doing. (Emphasis in original).
The early case of Windsor v. Polk County, 115 Iowa 738, 742, 87 N.W. 704, 705 (1901), includes this statement:
If the board unlawfully refused to him, when joined by the lawful number of petitioners, the relief expressly given by the statute, ...-it invaded his clear legal right of having effect given to the petition; and, if it cannot be compelled by mandamus to discharge its duties under such circumstances, the petitioners are left without a remedy for the enforcement of this right. From its very nature the petitioners can have no pecuniary interest in this matter, save in common with the taxpayers of the county; but, as the law confers the right to an order submitting the proposition to an election, it cannot be said not to recognize in them an interest in its enforcement. It is not contemplated that they be left without a remedy or with a remedy depending solely upon the will of the county attorney.
These principles apply to the matter now before us. The courthouse is the place where the business of the county is conducted-where citizens go to pay taxes, obtain licenses, record instruments, and attend court. It is the place where the supervisors regularly meet to settle county affairs. The plaintiffs as citizens and taxpayers of Ida County have an interest in common with all other citizens in the safety and proper maintenance of the building. We hold plaintiffs have standing to maintain this action.
III. This brings us to the ultimate question: were defendants entitled to judgment on the pleadings? We hold they were not.
Plaintiffs seek to make defendants comply with the state fire marshal's order concerning repair of the courthouse. The order was issued pursuant to section 100.13, The Code. It set out eight specific defects which made the building unsafe for occupancy. Although there are provisions for review by the marshal (§ 100.14-15) and for judicial review under the Iowa Administrative Procedure Act (§ 100.16), no such remedy was pursued. The order thus became final and enforceable under sections 100.26-27, The Code.
As we view the record before us, the parties are in disagreement about the obligation of the supervisors to make repairs. Defendants contend they have the power, but not the duty, to do so (§ 332.3, The Code). The extent to which this is affected, if at all, by the fire marshal's order remains undecided. Another principle comes into play here. That is the duty of the defendants to furnish adequate court facilities independent of specific statutory direction. This is fully discussed in Webster County Board of Supervisors v. Flattery, 268 N.W.2d 877 (Iowa 1978).
The foregoing, of course, are legal, not factual, matters; yet they are inextricably related to defendants' claim that they did-notwithstanding an absence of duty-go forward with repairs and that they were proceeding to comply with the fire marshal's order with all due diligence. Plaintiffs, on the contrary, asserted the conditions which *359 first made the courtroom unusable still existed at the time defendants' motion for judgment on the pleadings was filed. A determination of this question involves, among other things, whether this action is an attempt to control defendants' proper exercise of discretion; whether defendants' conduct has been arbitrary and capricious; and the effect, if any, of a stipulation entered into between the parties. The case, too, is shot full of suggestions that this matter even as early as January, 1979, was moot. This is something which cannot be decided on the record before us.
All of these questions-some legal, some factual, and some mixed-make judgment on the pleadings inappropriate. Such a motion is not designed to resolve controverted issues, only to decide if they exist. We hold they do. The judgment is therefore reversed, and the case is remanded for further proceedings.
REVERSED AND REMANDED.
