
18 Cal.App.2d 232 (1936)
EUGENE N. FRITZ, Jr., et al., Petitioners,
v.
THE SUPERIOR COURT OF THE CITY AND COUNTY OF SAN FRANCISCO, Respondent.
Civ. No. 10361. 
California Court of Appeals. First Appellate District, Division Two.  
December 21, 1936.
 Bertram H. Ross for Petitioners.
 Joseph A. Brown and A. E. Cross for Respondent.
 Nourse, P. J.
 This is an original proceeding for a writ of prohibition. The petitioners herein were joined with fictitious defendants in an action filed in the superior court for declaratory relief and an injunction. The controversy arose over conflicting claims of several individuals as officers of the Apartment House Association of California, Inc. The defendants answered, pleading an election of new officers after the complaint was filed and their consequent removal from that capacity. Their answer affirmatively alleged that, by reason of these changes, none of these defendants made any claim to be entitled to hold, or to exercise the duties of, any office of the corporation. A motion was then made in the superior court to dismiss the action upon the ground that no justiciable question was before the court. This motion was denied.
 [1] The whole controversy involves the validity of the claim of the respective parties to act as officers and directors of the corporation. Section 315 of the Civil Code provides an appropriate remedy to determine such disputes. By that section any shareholder may file an action in the superior court to determine the validity of any election or appointment of any director. Upon filing the complaint "and before any further proceedings are had", the court shall enter an order fixing a date for the hearing which must be served, with a *235 copy of the complaint, upon the corporation and upon the person or persons whose election is questioned. Since this is the method provided by statute, a substantial compliance therewith is necessary to give the court jurisdiction. Here the complaint was filed by the corporation and certain officers, not by a shareholder as required by the statute. An examination of the record discloses that no order was made by the trial court and, of course, none was served upon the defendants. This is necessary "before any further proceedings are had". Except when the remedy provided in this section is pursued, no injunction may issue to restrain a corporate officer in possession from exercising the duties of his office. (Sec. 526, Code Civ. Proc.)
 [2] In support of the demurrer it is argued that, notwithstanding the failure to comply with the statute, the complaint is good in an action for declaratory relief, or in equity. An action for declaratory relief is authorized by section 1060 of the Code of Civil Procedure "in cases of actual controversy relating to the legal rights and duties of the respective parties". Here the complaint pleads the necessity for a declaration of the rights or duties of the corporation and of the respective parties concerning the conflict as to the officers of the corporation. It is in every respect a plea for a determination of the validity of the election of certain persons as officers of the corporation and every plea and prayer of the complaint revolves about the question of such election. Though the existence of an available remedy in the ordinary action at law or in equity does not necessarily bar the right to proceed under these sections of the code (Wollenberg v. Tonningsen, 8 Cal.App.2d 722, 726 [48 PaCal.2d 738]) nevertheless, the character of the action must be determined from an examination of the facts pleaded, rather than from the title or prayer for relief, and when, upon such examination, it appears that the cause of action has already accrued and the only question for determination is the liability or relief for or to which the respective parties are charged, "the nature of the action is not a cause for declaratory relief but is defined by the subject matter of the accrued cause of action." (Standard Brands of California v. Bryce, 1 Cal.2d 718, 721 [37 PaCal.2d 446].)
 [3] Applying this principle to the case at hand we find a cause of action accrued before this suit was filed--a cause to *236 determine the validity of an election of corporate officers--and this is a cause for which an adequate and available remedy is expressly provided by law. Hence, though the prayer asks for declaratory relief, the facts pleaded show affirmatively that it is not a case for declaratory relief but one coming directly under section 315 of the Civil Code.
 [4] But, aside from this, a prerequisite to the maintenance of an action for declaratory relief is an "actual controversy relating to the legal rights and duties of the respective parties". (Sec. 1060, Code Civ. Proc.) The record here shows that no such controversy exists or could exist under the facts pleaded. The three named defendants were alleged to have claimed the right to hold office by reason of an election held some time prior to September 7, 1935. On that date new officers were chosen, and they are joined in the complaint as plaintiffs. On September 9, 1936, a new set of officers was chosen at a convention held in Los Angeles, and on September 11, 1936, another set of officers was chosen at a convention held in San Jose. None of the defendants was elected to any office at either of these 1936 elections, and none has made any claim to act as such since these elections. All these facts are undisputed and, by plaintiff's express admissions, no controversy exists which would justify an action for declaratory relief as between the parties to this proceeding.
 [5] Hence, in both phases of the case--as an action to determine the validity of the election under section 315, and as an action for declaratory relief--no actual controversy exists between the parties to constitute a justiciable issue before the trial court. The rule is universal that the courts will not entertain an action under section 315 after the directors sued have been supplanted by others at a subsequent election because the conduct of the election is at the bottom of the issue to be determined, and the validity of one election cannot be determined by the trial of one held at a previous time and under different conditions. [6] As to the other phase of the case, we have already said that the statute demands an "actual" controversy between the parties and such controversy cannot exist where both parties, by their own action, have removed the grounds of controversy. This was done when the plaintiff corporation held a new election and chose a new set of officers effectively removing the defendants *237 as parties to such controversy. If any dispute arises as to the legality or effect of the 1936 election that is not the subject-matter of the cause of action now pending before the superior court.
 [7] Finally it is argued that the plaintiffs have some cause of action in reference to an investment certificate in a savings and loan society, which is owned by and is in the name of the corporation. A false issue is raised on this matter, and the trial court should not be burdened with a trial of it. While acting as president of the corporation, one of the defendants exercised his authority as such in relation to this certificate and the fund represented by it. No claim is made that any of the defendants at any time made any adverse claim to the certificate or to the fund other than as officers of the corporation. This relation having been terminated by the election of new officers, there is no issue to be tried in respect to the fund.
 [8] The three petitioners herein moved for a dismissal of the action upon the ground that all the matters pleaded had become moot through the termination of their official status. The facts upon which this motion was based are all conceded and, as to these petitioners, the motion should have been granted. [9] The petitioners point out they have no appeal from the order denying their motion and that, having pleaded that they have no interest in the subject-matter of the litigation, and hence not being parties "aggrieved", they have no right to appeal from a judgment if one should be entered adverse to them. These are matters which are urged by petitioners to show that they have no remedy except through this proceeding. If the remedy of plaintiffs is to be found in section 315 alone, then the failure to procure the order mentioned in that section would divest the court of jurisdiction to take "any further proceedings" except to dismiss the action and would also nullify all proceedings taken by the parties by way of new pleadings, service of process, and hearing of demurrers and motions. But, since the proceeding attempts to state other causes of action, though ineffectually, it is conceivable that the court might still retain some jurisdiction to pass upon these matters, and for that reason we prefer to treat this application as one for a writ of mandate rather than as one for prohibition. This practice has been universally followed where the *238 facts developed upon the hearing disclose that the petitioner is entitled to the relief sought, but under a different form of writ than that prayed for. (Board of Trustees of Stanford University v. Board of Equalization, 1 Cal.2d 784, 787 [37 PaCal.2d 84, 96 A.L.R. 775], where a writ of mandate was issued following a hearing upon a petition for a writ of Certiorari.
 It is ordered that a peremptory writ of mandate issue directing the respondent court to dismiss the proceeding No. 266892 as to all these petitioners.
 Sturtevant, J., and Spence, J., concurred.
