radio button validation - Programmers Heaven

Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

radio button validation

drpagaldrpagal Posts: 1Member
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

  • CyGuyCyGuy Posts: 312Member
    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.

  • CyGuyCyGuy Posts: 312Member
    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.