asp.net-javascript validation
<p>i have a button..and i want to use javascript to validate certain fields on the button click and if the validation has passed i need to then execute the code in the code behind..any suggestions please guys!</p>

<p>Thanks in advance.</p>

<p>here is my javascript:</p>

<pre><code>function validateFields() {

    function checkCampaignStatus() {
        var rdbCampStatus = document.all('&lt;%=rdbCampStatus.ClientID%&gt;');
        var radio = rdbCampStatus.getElementsByTagName("input");
        var isChecked = false;
        for (var i = 0; i &lt; radio.length; i++)
        {
            if (radio[i].checked)
            {
                isChecked = true;
                break;
            }
        }
        if (!isChecked)
        {
            showOk('Save/Close', 'Please fill in all mandatory fields');
            document.getElementById('popupControl').style.display = 'block';
            document.getElementById('divEntryMain').style.display = 'none';
            document.getElementById('divBuilderMain').style.display = 'none';
            return false;
        }
        return true;
    }

    function checkCreatedBy() {
        var createdBy = document.all('&lt;%=txtCreatedBy.ClientID%&gt;').value;
        if (createdBy == "")
        {
        return false;
        }
    }
}
</code></pre>
