Hello:

I am working on a form validation script that uses the JQuery form validation script. My initial validation works fine, but I have run into a snag:

My first check is to make sure a file has been entered to be uploaded. If one has not and "Submit" is click, the form validation alerts the user to enter a file to upload.

I want to do the same thing for the two radio buttons, but since the validation works off of IDs and I can have only one unique ID per page, I am at a lose how to do this type of validation.

Can my script be adjusted to use the radio button group NAME instead? If both radio boxes are empty trigger the form validation:

Code:
<script>

$(document).ready(function(){

    addListRequired = ["upload-mailing-file"];

    addListDataMissing = "";

    $("#upload-mailing-list").submit(function(){

        for (i=0;i<addListRequired.length;i++) {
            var input = $('#'+addListRequired[i]);
            if ((input.val() == "") || (input.val() == addListDataMissing)) {
                input.addClass("data-required");
                input.val(addListDataMissing);
            } else {
                input.removeClass("data-required");
            }
        }

        if ($(":input").hasClass("data-required")) {
            return false;
        } else {
            return true;
        }
    });

    $(":input").focus(function(){
        if ($(this).hasClass("data-required") ) {
            $(this).val("");
            $(this).removeClass("data-required");
        }
    });

});

</script>

<form class="upload-form" id="upload-mailing-list">

...

	<label for="upload-mailing-file">file</label>

	<input id="upload-mailing-file" name="upload-mailing-file" type="file" />


	<label for="import-append">In addition to my current list</label>

	<input type="radio" id="import-append" name="after-import" value="append" />


	<label for="import-replace">Replace my current list</label>

	<input type="radio" id="import-replace" name="after-import" value="replace" />

...
    
	<button type="submit">Upload</button>
</form>

Thanks.