
437 P.2d 483 (1968)
E.A. WARD and Florence M. Ward, Husband and Wife, Respondents,
v.
The BEEM CORPORATION, Martin Barnett, Dba Western Motels and Investments, Oregon Adjustment Bureau, an Oregon Corporation, Harry K. Tickler and A. Louise Tickler, Husband and Wife, Colburn R. Thomason and Valdene R. Thomason, Husband and Wife, National Motel Listings, Inc., a Corporation, Appellants.
Supreme Court of Oregon, Department 1.
Argued and Submitted January 4, 1968.
Decided February 21, 1968.
*484 Carl M. Felker, Roseburg, argued the cause for appellants. With him on the briefs were Geddes, Felker, Walton & Richmond, Roseburg.
Edward M. Murphy, Roseburg, argued the cause for respondents. With him on the brief were Stults, Jayne & Murphy, Roseburg.
Before PERRY, C.J., and McALLISTER, O'CONNELL, DENECKE and LANGTRY, JJ.
O'CONNELL, Justice.
This is a suit in which plaintiffs seek a declaratory judgment pronouncing that defendants' second mortgage and the indebtedness supporting it were legally discharged by previous foreclosure proceedings. Defendants appeal from a decree granting plaintiffs' prayer for relief.
Plaintiffs purchased Cavalier Lodge in Roseburg from The Beem Corporation. As consideration for the transfer plaintiffs assumed a first mortgage on the property, transferred certain property in Fresno, California, and signed five notes totaling $43,365 secured by a second mortgage which is conceded to be a purchase money mortgage. The first of these notes was for $20,000 and the other four notes totaling $23,365 were payable to four brokers who participated in the sale and who were entitled to commissions. Plaintiffs had obligated themselves to pay these commissions. The four notes were as follows: $6,503 which was transferred to defendants Tickler; $7,503 which was transferred to defendants Thomason; $3,810 payable to defendant National Motel Listings, Inc.; and $5,549 payable to defendant Barnett. Plaintiffs have stipulated that the Barnett note is still valid. Plaintiffs contend that the indebtedness represented by the notes held by the Ticklers, Thomasons and National Motel Listings, Inc. were discharged by the foreclosure of the first mortgage.
Umpqua Savings & Loan Association, the holder of the first mortgage, brought suit on February 19, 1965 to foreclose its mortgage. All five note holders were made parties. Defendants The Beem Corporation, Ticklers, Thomasons, and National Motel Listings, Inc., all joined in a single answer. In its complaint Umpqua Savings & Loan Association prayed for a decree declaring that the interest of each of the defendants was secondary and subordinate to plaintiff's mortgage lien; that plaintiff's mortgage be foreclosed and the property sold. The prayer continued as follows:
"* * * [T]hat out of the proceeds of said sale plaintiff be paid the sums found due as principal, interest, insurance premiums and interest, attorney's fees, costs and disbursements, and the overplus, if any there be, be paid to defendants as their interest may appear, and the purchaser at said sale be placed in possession of said premises, free and clear of any and all claims of the defendants herein, and each of them, except statutory rights of redemption * * *."
In their answer to the complaint in the foreclosure proceeding the defendants prayed for a decree as follows:
"1. That the Court determine that there be due and owing these answering Defendants on the notes secured by the above mortgage the sum of $ ____.

*485 "2. Decreeing that the Defendants' mortgage is a good, valid and subsisting lien against the real property more particularly described in their mortgage, and that the same be subject and inferior only to the lien of Plaintiff's mortgage in and to said real property.
"3. That these answering defendants be entitled to recover as reasonable attorney's fees for the foreclosure of their mortgage the sum of $2000 and that upon foreclosure and sale of the properties in these proceedings that after the payment of Plaintiff's mortgage that any overplus there be, be applied in payment and satisfaction of these answering Defendants' mortgage and their attorney's fees.
"4. That the Court make and order such other and further relief as to it may seem just and equitable."
The foreclosure decree provided in part as follows:
"* * * [T]hat defendants * * * have a good, valid and subsisting mortgage and lien against the real property described in plaintiff's complaint which lien is secondary and inferior to plaintiff's mortgage lien.
"* * *
"* * * [T]hat plaintiff's said mortgage be foreclosed and that the property described therein be sold by the Sheriff of Douglas County, Oregon, in the manner provided by law and that out of the proceeds of said sale plaintiff be paid the sums found due as principal, interest, insurance premiums, attorneys' fees, costs and disbursements herein incurred, and the overplus, if any there be, be paid into the registry of this Court for further determination between the defendants herein and that the purchaser at said sale be placed in possession of said premises, free and clear of any and all of the claims of defendants herein, and each of them, save and except statutory rights of redemption."
On November 22, 1965 the property was sold at foreclosure sale to Umpqua Savings & Loan Association for $182,700, which was $11,894.88 less than the amount which was owing on the first mortgage. However, pursuant to the mortgage which covered rents and profits, the receiver had collected $16,091.02. Out of this latter sum $11,894.88 was paid to the first mortgagee pursuant to an order of the court entered on February 2, 1966, thus fully discharging the obligation on the first mortgage and leaving a residue in the receivership fund of $4,196.14. By an order of the court entered on April 12, 1966, the $4,196.14 was distributed as follows: $1,000 to the First National Bank of Roseburg, holder of a chattel mortgage, and $3,196.14 to the law firm representing some of the answering defendants to apply on the second mortgage debt for which the five notes were given. The order recites "that said Defendants in their answer and cross complaint further asked the Court for a decree authorizing payment to them of any overplus existing after the first mortgage of the Plaintiff had been paid in full." The order also contains a recital that the sum of $3,196.14 should be paid to the holders of the second mortgage "for the reason that said sum constitutes overplus after payment in full of the first mortgage and for the further reason that the first mortgagee elected to receive satisfaction from his prior mortgage out of the sale of the land and without first exhausting the funds held by the receiver." The order then directed the distribution of the $3,196.14 to the second mortgagees "as their interest may appear under said mortgage."
The issue on appeal is whether defendants are barred from bringing actions on their notes as a consequence of their participation in the foreclosure proceedings. The applicable statute is ORS 88.070, which reads as follows:
"When a decree is given for the foreclosure of any mortgage given to secure payment of the balance of the purchase price of real property, the decree shall provide for the sale of the real property covered by such mortgage for the satisfaction of the decree given therein, but *486 the mortgagee shall not be entitled to a deficiency judgment on account of the mortgage or note or obligation secured by the same."
This statute is construed to mean that a purchase money mortgagee has an election either to foreclose his mortgage, in which case he is barred from bringing an action on the mortgage debt, or to obtain a judgment on the mortgage debt, in which case he loses his mortgage lien.[1]
Defendants contend that their participation in the foreclosure proceedings did not constitute an election to assert their mortgage lien because in those proceedings the court had not determined the amount due and owing on their mortgage debt and failed to decree that the property be sold to satisfy their mortgage debt. It is argued that the decree did not foreclose the second mortgage but at most had the effect of granting an involuntary nonsuit against defendants on their prayer for the foreclosure of their mortgage.
It is clear that if defendants had failed to answer and permitted a default decree to be entered against them the foreclosure of the first mortgage would not bar their right to recover on their mortgage notes.[2] As the court said in Lutz v. Blackwell, 128 Or. 39, 43-44, 273 P. 705, 706 (1929), the defendant's "failure to appear in the equity suit and ask the court to determine the amount due upon his note, foreclose his mortgage and determine the order of distribution of the proceeds of the sale, evidences only an election to waive the security, and look to the obligor upon the note for payment of the same."
But in the present case defendants filed an answer in which they, in effect, prayed for a foreclosure of their mortgage and "that any overplus there be, be applied in payment and satisfaction of these answering Defendants' mortgage." Defendants not only prayed for the application of the overplus in the payment and satisfaction of their mortgage, they in fact received a part of the overplus after the first mortgage was satisfied. The foreclosure decree, complying with defendants' prayer for relief, ordered that "the overplus, if any there be, be paid into the registry of this Court for further determination between the defendants herein." This reference to a determination of defendants' interest in the surplus would properly refer only to defendants' rights as a mortgagee because only those persons who then were junior encumbrancers would be entitled to share in the surplus.[3]
In summary, then, we have a case in which defendants pray for and receive relief to which they are entitled only as mortgagees. The substance of their defense is that the foreclosure decree did not expressly provide that their mortgage was also foreclosed. This attaches too much significance *487 to the technical wording of the decree, and elevates form above substance.[4]
We hold that defendants' conduct constituted an election to enforce their mortgage lien and that they thus waived their right of action on the mortgage debt. Contrary to defendants' contention, we find that plaintiffs have presented a justiciable controversy.
The decree of the trial court is affirmed.
NOTES
[1]  The foreclosure of the mortgage bars a subsequent action on the debt. Wright v. Nothnagel, 163 Or. 156, 96 P.2d 228 (1939); Marshall v. Middleton, 100 Or. 247, 191 P. 886, 196 P. 830, 19 A.L.R. 1421 (1921); Wright v. Wimberly, 94 Or. 1, 184 P. 740 (1919). The holder of a mortgage note may waive the mortgage and bring an action on the note. Stretch v. Murphy, 166 Or. 439, 112 P.2d 1018 (1941); Phillips v. Elliot, 144 Or. 694, 17 P.2d 1119, 25 P.2d 557 (1933) (overruled on other grounds); Lutz v. Blackwell, 128 Or. 39, 273 P. 705 (1929); Page v. Ford, 65 Or. 450, 131 P. 1013 (1913).
[2]  Lutz v. Blackwell, 128 Or. 39, 273 P. 705 (1929).
[3]  A part of the surplus was distributed to the First National Bank of Roseburg which held a chattel mortgage on personal property in the motel. It appears that this distribution was made pursuant to a stipulation of the parties to resolve a dispute over the ownership of the funds representing rents and profits from the property. The order of distribution also included defendant Barnett as a distributee in spite of the fact that Barnett did not answer in the foreclosure proceedings. The propriety of this distribution to Barnett is not now an issue before this court, and the trial court's order in this respect is of no importance in determining whether defendants' conduct in seeking and receiving a part of the mortgage surplus constituted an election to rely upon their mortgage.
[4]  As the trial court observed, "It appears probable that the difficulties arise in this case because the decree of foreclosure obtained by the Umpqua Savings & Loan was one entered upon stipulation of the parties and was not in language normally found in a foreclosure decree in which a second subsequent or junior lienholder's lien also is declared valid and their respective priorities enumerated and likewise foreclosed."
