mljonzs
Posts: 124
|
| Posted: 03/28/2007, 8:40 AM |
|
Hello, It's me again. I'm having difficulties in my ASP Code Charge application in doing some data validations.
I have a radio Button control on my page. When user clicks the submit button (to insert or update) I need to make sure that they selected something for this control - no default value is set so on a new record nothing is selected yet. I have a javascript file that I use for various control validations, but I can't seem to figure out how to check that something was picked (and which selection was picked) for the radio button.
Here is the basic format I use to check for a value in a TextBox control, but similiar logic does not work for the RadioButton.
function ValidateForm() {
var en = document.getElementById("en").value;
if (en.length == 0) {
alert("End-User Name is required for starting a New Profile!");
return false;
}
return true;
} // end ValidateForm
Any suggestions?
Thanks, Michelle
_________________
What does not begin WITH God, will end in failure!
|
 |
 |
knoops
Posts: 23
|
| Posted: 03/29/2007, 4:08 AM |
|
Why not simply set the Required-property for the RadioButton? Or use the Validation Rule to '#' (or whatever the correct syntax is...) so that it checks for a numeric value (0/1) on submit...
|
 |
 |
micjon
Posts: 8
|
| Posted: 03/29/2007, 7:51 AM |
|
The end-users do not like the way Code Charge handles things when I use the Required property or validation so I have interceeded it with my own javascript to display a warning box with information. It works well but like I originally stated, I am not picking up the radio button correctly.....
|
 |
 |
knoops
Posts: 23
|
| Posted: 03/29/2007, 8:38 AM |
|
With JavaScript the element.checked (or was is element.selected?) is to be tested for a true or false value when using checkboxes, lists or radioboxes. The element.value is only valid for textboxes. Google for "javascript reference" and see what properties are available.
|
 |
 |
|