Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom Validation of a Radio Button List

Status
Not open for further replies.

qwert231

Programmer
Sep 4, 2001
756
US
I want to make sure that a customer specifies their selection in my radio button list. Their is no default choice. But with my custome Validator, what can I do to check this?
 
qwert: Have you tried a "Required Validator" for the check box group? I haven't checked this myself. Of course, best to do this with client side Java, but a simple VB statement would work also but would require a post back, which, in this situation, should I suppose be avoided.
 
Validators would be done at time of button pushing, not when something is selected... I believe...
 
qwert: No problem there. A simple VB statement asking if &quot;Checkbox Group > -1&quot; (true) ought to do it. But this requires a post back. No doubt you could do this in Java but if the entire group can't be isolated as a unit, then you'd have to find all checkbox id's came back with <> -1 (not true) result. Also you might be able to use client side VBScript. You could alternatively post at the Java Forum for validation routine on a group of checkboxes. Those programmers over there would no doubt jump on that one. For a post back using VB:

Sub btnMybutton_Click (s As Object, e As EventArgs)
'check group of checkboxes
If IsDbNull (GroupName) 'or If GroupName <>-1
'send message to label in bold,red e.g.
Exit Sub
Else
'continue on...
End If
End Sub
 
qwert. Look at Bronze's post 3 or 4 below yours (checkbox list validator on user control). He has the Javascript routine you are looking for; just needs to work out a problem with it. You might tackle that angle.
 
Hmmm... considering that I do not know Java, and I am in the .Net forum, I think I will stick to the Validation control that is already built (thanks to .Nets rich toolset).

Thank you tho, with the RequiredFieldValidator for the radio button list and a CustomValidator for a dropdown list it seems to be working. However, they do not work at the same time.

For instance, I come to the page, enter data, click the button, and the RadioList validator error pops up. But both controls should be invalid. If I correct the RadioList and click the button I then get the error for the DropDownList, but why does my customer need to click twice to see the errors?
 
qwert: You might try a SummaryValidation Control (can call for a pop up list of list on page at some location). Evidently from your results once a Validator is found to be not true, it reports back and stops processing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top