radio button validation

Currently without any javascript if a user does not select a radio button, it goes to a Coldfusion error page. Someone before me wrote the actual page and I, of course, needs to fix it. So i'm trying to add the following javascript and still goes to the cf error page. Any help would be great!





function validate()
{
var a = document.getElementById('Abstract');
var b = document.getElementById('Book');
var c = document.getElementById('Paper');
var d = document.getElementById('Presentation');
var e = document.getElementById('Oral');
var f = document.getElementById('Journal');
var g = document.getElementById('Public');
var h = document.getElementById('Internal');
var i = document.getElementById('Good');
if ( (a.checked == false )
&& (b.checked == false )
&& (c.checked == false )
&& (d.checked == false )
&& (e.checked == false )
&& (f.checked == false )
&& (g.checked == false )
&& (h.checked == false )
&& (i.checked == false ) )
{
alert ( "Please Choose Document Type" );
document.frmSubscription.document.focus();
return false;
}
return true;
}



===

===













Comments

  • Coldfusion is not my forte, but there is a tag that is documented [link=http://www.adobe.com/livedocs/coldfusion/5.0/CFML_Reference/Tags29.htm]here[/link] specifically stating that java is required along with an action attribute to that tag.

    Adding events is complicated enough without returning values. I suggest you simplify the javascript in the onclick by limiting validation to a single function. Perhaps by placing the ValidateForm() function inside the validate function assuming ValidateForm has been declared.

  • Coldfusion is not my forte, but there is a tag that is documented [link=http://www.adobe.com/livedocs/coldfusion/5.0/CFML_Reference/Tags29.htm]here[/link] specifically stating that java is required along with an action attribute to that tag.

    Adding events is complicated enough without returning values. I suggest you simplify the javascript in the onclick by limiting validation to a single function. Perhaps by placing the ValidateForm() function inside the validate function assuming ValidateForm has been declared.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion