• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 389
  • Last Modified:

Radio Buttons and submit buttons in asp

Hello,
I need help on the follwing code. I have two radio buttons and one submit button.  What I need to do is only when one of the radio buttons are checked should the send email button get activated otherwise it should be disabled.  Can somebody help me on this.  Greatly appreciate your help.

<script language = "Javascript">

function submitSP()
{
  document.getElementById('subEmail').value='Please Wait';
  document.getElementById('subEmail').disabled= true;
  return true;
}
</script>

<p><h4><i><font color = "Red">When you are done updating the table please click on.</i></font></h4></p>
<form method="post" id=form1 name=form1 action="SP.asp" Onsubmit="return submitSP()" >
<input name="Submit" type="Submit"></form>
<br>

<script language = "Javascript">
function EmailValidate()
{
     if (confirm("Are you sure? This will send Email to all!!!"))
     {
          return true;
     }
     else
     {
          return false;
     }
     
}
</script>

<p><h4><i><Font color = "Red"> Please choose the message to be Emailed :</font></i></h4></p>

<script language=javascript>
         function SelectButton()
         {
             if (document.YourForm.Radio(0).checked)
                 document.YourForm.action = "SP4.asp";
             else    
                 if (document.YourForm.Radio(1).checked)
                     document.YourForm.action = "SP5.asp";
           }
   </script>
 
         <Form Name="YourForm" Method="Get" OnClick="JavaScript:SelectButton() "OnSubmit ="return EmailValidate()">
           <Input Name="Radio" Type="radio" Value="Check">Letter1<br>
           <Input Name="Radio" Type="radio" Value="Check">Letter2<br/><br/>
           <input id = subEmail name="Submit" type="Submit" value ="Send Email" >
    </Form>
<br>


0
Lalitha_Ramalingam
Asked:
Lalitha_Ramalingam
  • 2
1 Solution
 
fritz_the_blankCommented:
Here you go:

<script language = "Javascript">

function submitSP()
{
  document.getElementById('subEmail').value='Please Wait';
  document.getElementById('subEmail').disabled= true;
  return true;
}
</script>

<p><h4><i><font color = "Red">When you are done updating the table please click on.</i></font></h4></p>
<form method="post" id=form1 name=form1 action="SP.asp" Onsubmit="return submitSP()" >
<input name="Submit" type="Submit"></form>
<br>

<script language = "Javascript">
function EmailValidate()
{
     if (confirm("Are you sure? This will send Email to all!!!"))
     {
          return true;
     }
     else
     {
          return false;
     }
     
}
</script>

<p><h4><i><Font color = "Red"> Please choose the message to be Emailed :</font></i></h4></p>

<script language=javascript>
         function SelectButton()
         {
             if (document.YourForm.Radio(0).checked)
                 document.YourForm.action = "SP4.asp";
             else    
                 if (document.YourForm.Radio(1).checked)
                     document.YourForm.action = "SP5.asp";
           }
   </script>
 
        <Form Name="YourForm" Method="Get" OnClick="JavaScript:SelectButton() "OnSubmit ="return EmailValidate()">
           <Input Name="Radio" Type="radio" Value="Check" onClick="this.form.Submit.disabled=false;">Letter1<br>
           <Input Name="Radio" Type="radio" Value="Check" onClick="this.form.Submit.disabled=false;">Letter2<br/><br/>
           <input id = subEmail name="Submit" type="Submit" value ="Send Email" disabled>
    </Form>
<br>
0
 
Lalitha_RamalingamAuthor Commented:
Thank you very much fritz.  Greatly appreciate your help.
Lalitha
0
 
fritz_the_blankCommented:
Glad to have helped,

FtB
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now