סימן יא סעיף יג
יֵשׁ אוֹמְרִים דַּאֲפִלּוּ אֵין דְּלָתוֹת לַפֶּתַח, חַיָּב בִּמְזוּזָה. וְיֵשׁ אוֹמְרִים דְּבָעֵינָן דַּוְקָא דֶלֶת. וְלָכֵן לֹא יִקְבַּע אֶת הַמְּזוּזָה עַד שֶׁיִּתְלֶה מִקֹּדֶם אֶת הַדֶּלֶת. וְלֹא יִקְבַּע אוֹתָהּ תְּחִלָּה וְאַחַר כָּךְ יִתְלֶה אֶת הַדֶּלֶת, מִשּׁוּם דְּבָעֵינָן תַּעֲשֶׂה וְלֹא מִן הֶעָשׂוּי (עַיֵּן לעיל סִימָן ט' סָעִיף ו').
There are some Halachic authorities who maintain that even if there are no doors on the entrance, it still requires a mezuzah, and there are others who maintain that there must be a door; and therefore you should not affix a mezuzah until you first hang the door. You should not first affix the mezuzah and then hang the door because we must comply with the scripture, "You shall make" and not from what is already made.6The inference of the Scripture according to the Sages is that at the time of the affixing of the mezuzah all criteria for the commandment must be met. If these criteria are complied with after the affixing of the mezuzah, the mitzvah is rendered invalid. There is also this inference in regard to the fulfillment of other commandments, e.g. the mitzvah of succah and the mitzvah of tsitzis. (See chapter 9).
תנא דבי אליהו כל השונה הלכות בכל יום מובטח לו שהוא בן העולם הבא שנאמר הליכות עולם לו אל תקרי הליכות אלא הלכות (נדה ע"ג.)