function ValidateData() { //Submission variable var CanSubmit = false; //Check there is something entered into the word list CanSubmit = ForceEntry("WordList", "Please enter words into the word list."); if (!CanSubmit) return; //Get the word count var count = GetWordCount(); var min_count = CalculateMinimumWords(); //If there aren't enough words, warn the user if (count 200) { document.LayoutBingo.method = "post"; document.LayoutBingo.VarsPosted.value = "true"; } //If fields have been entered correctly, submit the form document.LayoutBingo.submit(); } //end function function CalculateMinimumWords() { //Calculate the minimum number of required cards var cardCount = parseInt(document.getElementById("CardCount").value); var entryCount = parseInt(document.getElementById("EntryCount").value); //Return value for the competition being close if (document.getElementById("Competition close").checked) return Math.ceil(entryCount + (cardCount * 1.5)); //Random or very close are the same return cardCount + (entryCount - 1); } function GetWordCount() { //Grab the word list text var wordList = document.getElementById("WordList").value; //Split the word list into individual words var count=0; //Trim the word list - if it is completely empty, don't bother counting var trimmedList = wordList.replace(/^\s+|\s+$/g, '') ; if (trimmedList != "") { var words = wordList.split(/\s/); //Go through words and count (ignoring any empty indexes) for (var i=0; i(you need at least "+short+" more)"; return; } document.getElementById("WordCount").innerHTML = "Words entered so far: "+count; }