JavaScript in page question

Results 1 to 2 of 2

Thread: JavaScript in page question

  1. #1
    Join Date
    Dec 1969

    Default JavaScript in page question

    Hi,<BR><BR>I&#039;m trying to add javascript validation to a radion button. If the radio button has been checked then a value must be entered in a particular text box. I added the javascript to my page but it doesn&#039;t seem to be working. Could anybody give me some suggestions? Here&#039;s the code I have in my page;<BR><BR>&#060;script language=javascript&#062;<BR>****function getRadialValue(strFieldName){<BR>var objFormField = document.forms[0].elements[MedicalBenefitsCancel]<BR>intControlLength = objFormField.length<BR>for (i=0;i&#060;intControlLength;i++){ * * <BR>if(objFormField[i].checked){<BR>strValue = objFormField[i].value;<BR>return strValue;<BR> }<BR>* } * * <BR>* }<BR>* function validate(theForm){<BR> if(getRadialValue(&#039;MedicalBenefitsCancel&#039 ;)==&#039;Yes&#039;){<BR> if(theForm.MCobraCancelDate.value==&#039;&#039;){< BR> alert(&#039;Please enter a cancellation date!&#039;);<BR> return false;<BR> }<BR> }<BR>}<BR><BR><BR>&#060;/script&#062;<BR><BR>Here&#039;s where I call the function in my code behind page;<BR><BR>Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click<BR> btnSubmit.Attributes.Add("onClick", "return validate(theForm);")<BR><BR>Thanks in advance

  2. #2
    Join Date
    Dec 1969

    Default RE: JavaScript in page question

    do you get any errors?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts