
560 So.2d 337 (1990)
P.P. FISH and Irene Fish, Appellants,
v.
POST OF AMVETS # 85, Appellee.
No. 89-2266.
District Court of Appeal of Florida, First District.
April 25, 1990.
*338 Owen N. Powell, Bonifay, for appellants.
Frank A. Baker of Baker and Swearingen, Marianna, for appellee.
JOANOS, Judge.
P.P. Fish and Irene Fish have appealed an order of the trial court dismissing their third amended complaint with prejudice for failure to state a cause of action. We reverse.
Appellants filed their initial complaint against Post of Amvets # 85 (Amvets) in July 1987, seeking to quiet title in, and for ejectment from, certain real property. As statutorily required for such actions, appellants' complaint deraigned their title to the subject real property, commencing with a 1967 deed from one Bush to "United Klan of America, Ray King [and others], Trustees," and concluding with a 1987 deed from "United Klans of America, Inc." to appellants.
Amvets, who claimed title to the property under a 1985 lease from "United Klan of America by Ray King," moved to dismiss this complaint, and later, the first and second amended complaints, for failure to state a cause of action. These motions alleged that appellants' deraignment of title in those complaints did not demonstrate a valid conveyance from the trustees listed in the 1967 deed either to appellants or to their grantor, United Klans of America, Inc. The trial court granted these motions to dismiss with leave to amend.
*339 Appellants thereafter filed the third amended complaint at issue herein, deraigning their title as described above, and alleging that, at the time the subject property was purportedly leased to Amvets by King, King had no authority to do so. Amvets moved to dismiss the third amended complaint on the same ground stated above, and the trial court granted that motion with prejudice.
The function of a motion to dismiss a complaint is to raise a question of law as to the sufficiency of the facts alleged to state a cause of action. The court may not properly go beyond the four corners of the complaint in testing the legal sufficiency of the allegations set forth therein. Eiler v. Camp Dresser & McKee, Inc., 542 So.2d 441, 442 (Fla. 5th DCA 1989). Where a complaint is dismissed based on extraneous evidence leading the judge to believe that the plaintiff is not entitled to relief, the judge has reversibly erred. DeWitt v. Zimmerman, 366 So.2d 46 (Fla. 4th DCA 1978). Neither should legal defenses to the cause of action not shown on the face of the complaint be considered on a motion to dismiss, in that the framing of the issues should occur in the context of the complaint, answer and reply. Burch v. Brinkley, 382 So.2d 440, 441 (Fla. 1st DCA 1980).
With regard to the sufficiency of allegations concerning the appellants' title to the real property at issue, a complaint in ejectment need only contain a statement setting forth chronologically the chain of title upon which he will rely at trial. If any part of such chain of title is recorded, the statement must set forth the names of the grantors and the grantees, and the book and page of the record thereof. 20 Fla. Jur.2d Ejectment and Related Remedies, §§ 26, 29; § 66.021(4), Florida Statutes (1987). In a suit to quiet title, the plaintiff may allege the validity of his title in even more general terms, a mere allegation that he is the owner in fee of the lands in question being sufficient. 20 Fla.Jur.2d Ejectment and Related Remedies, § 130.
The third amended complaint herein complies with these strictures in all respects. While motions to test the legal sufficiency of instruments in an opponent's chain of title, accompanied by copies of such instruments, may be filed prior to trial, Section 66.021(5), Florida Statutes (1987), no such motions were filed herein. Rather, Amvets' motions and arguments were directed entirely to appellants' alleged inability to prove the validity of their title at trial. This is not the function of a motion to dismiss, wherein the sufficiency of the evidence which a plaintiff will be likely to produce in a hearing on the merits is wholly irrelevant and immaterial. 1 Fla. Jur.2d Actions § 137.
Because the motion to dismiss herein was apparently utilized in lieu of a trial on the merits of appellants' complaint, otherwise legally sufficient, the order dismissing the third amended complaint with prejudice is reversed, and the case remanded for further proceedings. We note that this opinion is not intended to, and does not, make any finding on the issue of whether all indispensable parties have been properly joined.
Reversed and remanded.
SMITH and WENTWORTH, JJ., concur.
