Our Gemara on Amud Beis tells us about the challenges the rabbinic administrators had in maintaining decorum during the Simchas Beis Hashoeyva.  After all, it is human nature to become more loose and indiscriminate during festive times  (see Be'er Mayim Chaim, Deuteronomy 16:18:11):

The Sages taught in the Tosefta: Initially, women would stand on the inside of the Women’s Courtyard, closer to the Sanctuary to the west, and the men were on the outside in the courtyard and on the rampart. And they would come to conduct themselves with inappropriate levity in each other’s company, as the men needed to enter closer to the altar when the offerings were being sacrificed and as a result they would mingle with the women. Therefore, the Sages instituted that the women should sit on the outside and the men on the inside, and still they would come to conduct themselves with inappropriate levity. Therefore, they instituted in the interest of complete separation that the women would sit above and the men below.

This is codified in halakah, that during the Yomim Tovim it is especially incumbent upon the leadership to promote adequate safeguards against undue levity, as it can lead to promiscuity (Shulkhan Arukh OH 530:4):

The court must appoint officers who will walk around patrolling gardens, orchards, and rivers, so that men and women will not gather there to eat and drink and end up sinning. They should similarly warn the whole nation about this - that men and women should not joyously mix in houses and overindulge in wine, lest they come to sin. Rather, all should be holy.

I think it is important to note the “cat and mouse” nature of this dynamic.  The Gemara records several failed attempts to rein in undesired frivolity and mingling.  They did not tell us about these failed attempts to teach us abstract history.  It is because they want us to know that it is human nature for this to occur.  

This reminds me of a famous story about Rav Hutner, ZT’L, who was known to be clever with words. Once he was at a bris in a shul where the women’s section was on a balcony. He noticed that his talmidim where looking more at the women than at the bris, so he called out, “לַבְּרִית הַבֵּט וְאַל תֵּֽפֶן לַיֵּֽצֶר!!”, which literally meant, “Look in the direction of the bris, and not the yezer hara.” This was, of course, a play on words from the Yamim Noraim piyut on Yom Kippur night.  

I will comment on the various efforts to mandate tznius behavior in yeshivos or Beis Yaakovs, focusing on external standards such as length of skirt, use of smartphones, etc. I am not endorsing promiscuity.  Rather, I am pointing out the need for patience and respect, as well as recognizing a certain degree of inevitability to it.  Such efforts at maintaining order and safeguards are proper and good, but also must be taken with a degree of salt, knowing that it is a never ending game, and that human nature will win at times. It is not a good idea to clamp down too hard, as it leads to becoming obsessed with rules instead of content and context.  The Gemara (Sanhedrin 107b) seems to advise that sometimes one should not attack the yetzer hara directly, but more gently and roundabout:

יצר תינוק ואשה תהא שמאל דוחה וימין מקרבת

With regard to the evil inclination, to a child, and to a woman, have the left hand drive them away and the right draw them near.  Essentially, the Gemara is saying that with sensitive, emotional people and parts of personality, “the child within”, one should be gentle and patient in trying to suppress improper behavior.

And, of course, one must also be careful not to suppress interactions between the sexes, that properly and modestly promote marriage. The Mishna Taanis (4:8) famously tells us of a twice yearly festival to solve the “Shidduch Crisis”:

There were no days as joyous for me the Jewish people as the fifteenth of Av and as Yom Kippur, as on them...the daughters of Jerusalem would go out and dance in the vineyards. And what would they say? Young man, please lift up your eyes and see what you choose for yourself for a wife.