Validator for radio button group

M

M. Ali Qureshi

Hi,

I have 3 radio buttons on my page with different IDs, but they are grouped
with name "Q1".

I need to add some kind of validator on them so that user must have to
select one of them.

I cannot use radiobuttonlist, its because these 3 radiobuttons have to be
placed in seperate table cells.

Could anyone help me on how i can acheive this?

Thanks in advance.
 
B

bruce barker

there a number of ways to do this. use getElementsByTagName, and checking the
name, but the simplest is to add the checkbox id to the validator

ClientScript.RegisterExpandoAttribute(myValidator.ClientID,
"chk1",checkbox1.ClientID);
ClientScript.RegisterExpandoAttribute(myValidator.ClientID,
"chk2",checkbox2.ClientID);
ClientScript.RegisterExpandoAttribute(myValidator.ClientID,
"chk2",checkbox2.ClientID);


then in the client validation function:

function chkValid(oSrc, args)
{
var chk1 = document.getElementById(oSrc.chk1);
var chk2 = document.getElementById(oSrc.chk2);
var chk3 = document.getElementById(oSrc.chk3);
}





-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top