...but that is prone to error since we have to change the index when we add new element especially above the radio button.

The best way for you to do, is to give your radio button a unique identifier:

<input type="radio" name="x13_Agreement" value="Yes" id="agree">

and use this script instead:

function agree(){
if(!document.getElementById('agree').checked){
alert('You must confirm that you are able to disclose information about this applicant to submit this application, please click the I CONFIRM button');
return false;
}
else { return true };
}

Hope it helps.

sutton silver

09-12-2008, 02:29 PM

Hi Both,

Thank you very much for your response!

I have implemented your code rangana

But I still can't seem to get this to work?!

Could you please check the page again on the same link and tell me If I have missed something?

function Agree(){
if(!document.getElementById('agree').checked){
alert('You must confirm that you are able to disclose information about this applicant to submit this application, please click the I CONFIRM button');
return false;
}
else { return true };
}

function/ids/variable names must be unique.
also suggest using a checkbox as opposed to a radio.

TwiztedIndian

12-16-2008, 05:04 AM

Hello, I tried to implement this into my script but it is not working.. I have a long form that needs multiple fields validated in addition now I need to validate some radio buttons. The script I am running now is working but I can not figure out how to get it to validate a radio button group.

Here is my current validation script

<script type="text/javascript">
<!--
function UpdateForm (obj1) {

var themessage = "You are required to complete the following fields:\n ";