D.B. appeals from a judgment of the Morgan Juvenile Court (“the juvenile court”) dismissing his petition to establish the paternity of A.L.K. (“the child”). We reverse.
Procedural History
On September 19, 2011, D.B. filed in the juvenile court a petition to establish the paternity of the child, whose date of birth is December 21, 2007. D.B. asserted that he is the biological father of the child; that the child’s mother, A.K. (“the mother”), had been married to J.K. at the time the child was born; and that J.K. had been serving with the United States military in Iraq at the time of the child’s conception. D.B. further alleged that, on January 24, 2008, the mother had filed in the Morgan Circuit Court a complaint seeking a divorce from J.K. in which she had stated, in pertinent part: “There has been one (1) minor child, namely [C.K.], whose date of birth is December 22, 2005, born of the marriage of the parties hereto. No other children are expected.” D.B. also alleged that J.K. had “signed an Answer and Waiver wherein he admitted] that there were no children other than [C.K.] born to the parties”; that the mother and J.K. had signed a settlement agreement addressing issues related to only one child, C.K.; and that, on June 16, 2008, the mother and J.K. were divorced by a judgment of the Morgan Circuit Court and that that judgment had incorporated the mother and J.K.’s settlement agreement. The child was not mentioned in the documents relating to the divorce proceedings.
D.B. further asserted that, on February 4, 2009, the juvenile court had entered a default judgment adjudging him to be the father of the child, ordering that the child’s birth certificate be amended to reflect D.'B.’s paternity, and awarding D.B. visitation with the child.1 He alleged that the mother had filed a motion to alter, amend, or vacate the default judgment, in which she stated that she had been married to J.K. at the time of the child’s conception and that he was listed as the father on the child’s birth certificate; the juvenile court subsequently entered an order setting aside the default judgment as void, stating that J.K. is the child’s legal father, making J.K. a party to the case, ordering the mother to provide J.K.’s address, and ordering the parties to appear for genetic testing. D.B. asserted that he did not receive notice to appear for that testing and that, after neither D.B. nor J.K. appeared for the genetic testing, the juvenile court entered an order on May 26, 2009, stating that, at the time the child was *948conceived, the mother was married to J.K., that J.K. was named as the father on the child’s birth certifícate, and that J.K. had not renounced his presumption of paternity of the child.
D.B. asserted that he had subsequently filed a petition seeking joint custody of the child and that the mother had moved to dismiss that petition on the ground that D.B. lacked standing.2 In support of her motion to dismiss, the mother attached an affidavit of J.K. signed on October 4, 2010, in which he stated:
“I understand that I am the legal father of [the child] under Alabama law. I do not wish to have a genetic test in this matter. [The child] is not mentioned in my Decree of Divorce. However, I wish to assert my parental rights with regard to [the child]. I am asking this Court to enter a specific finding of paternity with regard to [the child]. I am the father of [the child].”
Finally, D.B. alleged that he had visited with the child and had paid child support for the child. D.B. attached documentation supporting his allegations. He requested that the juvenile court order a paternity test to establish that he is the father of the child.
On November 1, 2011, the juvenile court entered a judgment holding that D.B.’s paternity claim was barred by the doctrine of res judicata and that he lacked standing to bring the paternity petition because J.K., the child’s legal father, had chosen not to disavow his parental rights to the child as evidenced by his October 4, 2010, affidavit.3 On November 14, 2011, D.B. filed his notice of appeal to this court.
Discussion
On appeal, D.B. argues that the juvenile court erred in dismissing his petition based on a lack of standing. We agree.
Pursuant to the Alabama Uniform Parentage Act (“the AUPA”), Ala.Code 1975, § 26-17-101 et seq., J.K. is the presumed father of the child because the child was conceived and born during the mother’s marriage to J.K. Ala.Code 1975, § 26-17-204(a)(1) & (2). “If the presumed father persists in his status as the legal father of a child, neither the mother nor any other individual may maintain an action to disprove paternity.” Ala.Code 1975, § 26-17-607(a). This court has held, however, that “a man seeking to establish paternity of a child born during the mother’s marriage to another man must be given the opportunity to establish standing in an evi-dentiary hearing where he and others may *949present evidence bearing on whether the presumed father ... had persisted in his presumption of paternity.” W.D.R. v. H.M., 897 So.2d 327, 331 (Ala.Civ.App.2004) (stating that, because it could not be determined as a matter of law that the presumed father had persisted in his presumption of paternity, the juvenile court must hold a hearing on that issue); see also R.D.B. v. A.C., 27 So.3d 1283,1287-88 (Ala.Civ.App.2009) (holding that, because the biological father’s “allegations ... call[ed] into question whether the legal father persisted] in his presumption of paternity,” the juvenile court “should permit the biological father and others to present evidence regarding whether the legal father persists in his presumption of paternity”); and J.O.J. v. R.R., 895 So.2d 336 (Ala.Civ.App.2004) (holding that evi-dentiary hearing must be held to determine whether the biological father had standing when there was no evidence regarding whether the child’s legal father had persisted in his presumption of paternity).
In the present case, based on D.B.’s allegations in his petition and the attachments thereto, D.B. presented the trial court with a controversy as to whether J.K. had persisted in his presumption of paternity, and, thus, the juvenile court should not have determined that issue on a motion to dismiss. Accordingly, we conclude that the juvenile court erred in dismissing D.B.’s petition without holding an evidentiary hearing to determine whether J.K. has persisted in his presumption of paternity. We therefore reverse the juvenile court’s judgment and remand this cause for the juvenile court to hold an evidentiary hearing in accordance with this opinion.
REVERSED AND REMANDED WITH INSTRUCTIONS.
THOMPSON, P.J., and PITTMAN and BRYAN, JJ., concur. THOMAS, J., concurs in the result, with writing.. The mother had filed the petition that had resulted in that judgment.
. D.B. did not state in which court he had filed his custody petition, the case number that was assigned to the petition, or the outcome of that action; however, it can be inferred from the record that he filed his custody petition in the Morgan Circuit Court, that the action was assigned case no. DR-10-624, and that the case was ultimately dismissed on October 20, 2010.
. We note that, because the juvenile court determined that D.B. lacked standing to bring his action, the juvenile court lacked subject-matter jurisdiction to further determine that the doctrine of res judicata barred his action. See, e.g., Cadle Co. v. Shabani, 4 So.3d 460, 463 (Ala.2008) ("When the absence of subject-matter jurisdiction is noticed by, or pointed out to, the trial court, that court has no jurisdiction to entertain further motions or pleadings in the case. It can do nothing but dismiss the action forthwith.”); and State v. Property at 2018 Rainbow Drive, 740 So.2d 1025, 1028 (Ala.1999) ("When a party without standing purports to commence an action, the trial court acquires no subject-matter jurisdiction.”). Therefore, that portion of the trial court’s judgment dismissing the case on the ground of res judicata is void, and we need not consider it further. However, we agree with the principle set forth in Judge Thomas’s special writing that a trial court may not dismiss a complaint sua sponte on the ground of res judicata. 93 So.3d at 949 (Thomas, J., concurring in the result).