Needing to make a textbox required if a particular radio button is selected

Hi, I have the following code that I am desperately trying to get to work.  Basically if the user selects a particular radio button, I need a textbox to become a required field.  I am not getting any errors, but this just isn't working.  The textbox is currently required regardless of what radio button is selected--and the only radio button selection that should require the textbox is "guest".
Thank you!
void status_SelectedIndexChanged (object sender, System.EventArgs e)
	{
 
		if (status.SelectedItem.Value == "guest")
		{
			RequiredFieldValidator4.Enabled = true;
		}
		else
		{
			RequiredFieldValidator4.Enabled = false;
		}
	}
 
 
 	
 
 
 
Status:*<br />														
  <asp:RadioButtonList ID="status" OnSelectedIndexChanged="status_SelectedIndexChanged" runat="server">
			<asp:ListItem Value="undergrad">undergraduate</asp:ListItem>
			<asp:ListItem Value="grad">graduate</asp:ListItem>
			<asp:ListItem Value="fs">faculty/staff</asp:ListItem>
			<asp:ListItem Value="guest">non-TWU (guest user)</asp:ListItem>
		</asp:RadioButtonList>
		<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="Server" ControlToValidate="status" ErrorMessage="Status" Text="*Status Required"></asp:RequiredFieldValidator><br />
		If you are a guest user,
		<br />
		please tell us what school are you from:<asp:TextBox ID="school" runat="server"></asp:TextBox>
		<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="Server" ControlToValidate="school" ErrorMessage="School Name" Text="*School Name Required"></asp:RequiredFieldValidator>
 
  <br /><br />

Open in new window

jianxin9Asked:
Who is Participating?
 
sm394Connect With a Mentor Commented:
simply create a new aspx page with no code behind
and copy paste code below i have tested and its working code let us know any issues
<%@ Page Language="C#" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<script runat="server">
 
    protected void Page_Load(object sender, EventArgs e)
    {
        statusCheckName.Attributes.Add("onclick", "showHide();");
        Page.ClientScript.RegisterStartupScript(this.GetType(), "OnLoadHandler", "showHide();", true);
    }
</script>
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
 
    <script type="text/javascript" language="javascript">
        function showHide() {
            var rows = document.getElementById('<%= statusCheckName.ClientID %>').getElementsByTagName("input");
 
            if (rows[2].checked)
                document.getElementById('<%=txtName.ClientID%>').style.display = "block";
            else
                document.getElementById('<%= txtName.ClientID%>').style.display = "none";
        }
 
 
        function isValidName(sender, args) {
            var rows = document.getElementById('<%= statusCheckName.ClientID %>').getElementsByTagName("input");
 
            if (rows[2].checked) {
                var txt = document.getElementById('<%=txtName.ClientID%>');
                args.IsValid = (txt.value.length > 0);
            }
        }
    </script>
 
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:CustomValidator ValidationGroup="Group2" ID="schoolName" runat="server" ClientValidationFunction="isValidName"
            ErrorMessage="If you are a guest, please enter your school name."></asp:CustomValidator>
        <asp:RadioButtonList ID="statusCheckName" RepeatDirection="Horizontal" runat="server">
            <asp:ListItem Value="grad">graduate</asp:ListItem>
            <asp:ListItem Selected="True" Value="fs">faculty/staff</asp:ListItem>
            <asp:ListItem Value="guest">guest user</asp:ListItem>
        </asp:RadioButtonList>
        Please tell us what school you are from if you are a guest user:
        <asp:TextBox runat="server" ID="txtName"></asp:TextBox>
        Open in New Window Select All
        <br />
        <asp:Button ID="Test" runat="server" ValidationGroup="Group2" Text="Go" />
    </div>
    </form>
</body>
</html>

Open in new window

0
 
jianxin9Author Commented:
thanks--i posted that last week and i was never able to get that to work the way i had hoped.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
sm394Commented:
well that is a tested and working solution based on the description you provided. You shold have asked for more details.
0
 
jianxin9Author Commented:
i understand and i appreciate the assistance you provided--i just had way too many errors, etc. when trying to implement the code and was hoping to find something that I could work with a little easier (since I am still pretty new at this).
0
 
jianxin9Author Commented:
I am trying the code and getting the following error.  I just can't quite figure out how to fit what I have into that code.  Can you please help?

 Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0103: The name 'txtName' does not exist in the current context

Source Error:

Line 151:
Line 152:            if (rows[3].checked) // 0index for yes
Line 153:                document.getElementById('<%=txtName.ClientID%>').style.display = "block";
Line 154:            else
Line 155:                document.getElementById('<%= txtName.ClientID%>').style.display = "none";
<script type="text/javascript" language="javascript">
       function showHide() {
            var rows = document.getElementById('<%= statusCheckName.ClientID %>').getElementsByTagName("input");
            //alert(rows[0].checked);
 
            if (rows[3].checked) // 0index for yes
                document.getElementById('<%=txtName.ClientID%>').style.display = "block";
            else
                document.getElementById('<%= txtName.ClientID%>').style.display = "none";
        }
 
 
        function isValidName(sender, args) {
            var rows = document.getElementById('<%= statusCheckName.ClientID %>').getElementsByTagName("input");
            //alert(rows[0].checked);
            if (rows[3].checked) {
                var txt = document.getElementById('<%=txtName.ClientID%>');
                args.IsValid = (txt.value.length > 0);
            }
        }
</script>
 
 
 
 
<asp:CustomValidator ValidationGroup="Group2" ID="schoolName" runat="server" ClientValidationFunction="isValidName"
        ErrorMessage="If you are a guest, please enter your school name."></asp:CustomValidator>
 
  <asp:RadioButtonList ID="statusCheckName" RepeatDirection="Horizontal" runat="server">               
			<asp:ListItem Value="grad">graduate</asp:ListItem>
			<asp:ListItem Value="fs">faculty/staff</asp:ListItem>
			<asp:ListItem Selected="True" Value="guest">guest user</asp:ListItem>
                </asp:RadioButtonList>
           
                Please tell us what school you are from if you are a guest user: <asp:TextBox runat="server" ID="school"></asp:TextBox>

Open in new window

0
 
sm394Commented:
change
<asp:TextBox runat="server" ID="school"></asp:TextBox>
to
<asp:TextBox runat="server" ID="txtName"></asp:TextBox>
0
 
jianxin9Author Commented:
Thanks again for posting--I do appreciate the help.  Okay, when I select "guest user" and then try to submit the form, I am not getting the validator message about the textbox being a required field.  This is what I am using--is there something with the custom validator that I need to do differently?
<script type="text/javascript" language="javascript">
       function showHide() {
            var rows = document.getElementById('<%= statusCheckName.ClientID %>').getElementsByTagName("input");
            //alert(rows[0].checked);
 
            if (rows[3].checked) // 0index for yes
                document.getElementById('<%=txtName.ClientID%>').style.display = "block";
            else
                document.getElementById('<%= txtName.ClientID%>').style.display = "none";
        }
 
 
        function isValidName(sender, args) {
            var rows = document.getElementById('<%= statusCheckName.ClientID %>').getElementsByTagName("input");
            //alert(rows[0].checked);
            if (rows[3].checked) {
                var txt = document.getElementById('<%=txtName.ClientID%>');
                args.IsValid = (txt.value.length > 0);
            }
        }
</script>
 
 
 
<asp:CustomValidator ValidationGroup="Group2" ID="schoolName" runat="server" ClientValidationFunction="isValidName"
        ErrorMessage="If you are a guest, please enter your school name."></asp:CustomValidator>
 
  <asp:RadioButtonList ID="statusCheckName" RepeatDirection="Horizontal" runat="server">               
                        <asp:ListItem Value="grad">graduate</asp:ListItem>
                        <asp:ListItem Value="fs">faculty/staff</asp:ListItem>
                        <asp:ListItem Selected="True" Value="guest">guest user</asp:ListItem>
                </asp:RadioButtonList>
           
                Please tell us what school you are from if you are a guest user: <asp:TextBox runat="server" ID="txtName"></asp:TextBox>
                        Portal Username: (optional)<br />
                        <asp:TextBox ID="portal_id" runat="Server" />
                        <br />
                        <br />

Open in new window

0
 
jianxin9Author Commented:
This is the validation summary I am currently using to validate my other required fields--do I need to adjust this?  Thanks!
  <asp:Button ID="b1" Text="Submit" runat="server" />
                        <asp:ValidationSummary ID="ValidationSummary1" ShowMessageBox="true" ShowSummary="false"
                            HeaderText="You must enter a value in the following fields:" EnableClientScript="true"
                            runat="server" />

Open in new window

0
 
sm394Commented:
did you add in code behind page load these lines

 this.statusCheckName.Attributes.Add("onclick", "showHide();");
 Page.ClientScript.RegisterStartupScript(this.GetType(), "OnLoadHandler", "showHide();", true);
0
 
sm394Commented:
change
 if (rows[3].checked)
to
 if (rows[2].checked)
 


0
 
jianxin9Author Commented:
Sorry--I know this is a lot of questions.  For the code behind, this is the error I am getting:

 Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1519: Invalid token 'this' in class, struct, or interface member declaration

Source Error:

Line 119:}
Line 120:
Line 121: this.statusCheckName.Attributes.Add("onclick", "showHide();");
Line 122:                 //to invoke javascript function on page load
Line 123:        Page.ClientScript.RegisterStartupScript(this.GetType(), "OnLoadHandler", "showHide();", true);
<script runat="server" language="C#"> this.statusCheckName.Attributes.Add("onclick", "showHide();");
                 //to invoke javascript function on page load
        Page.ClientScript.RegisterStartupScript(this.GetType(), "OnLoadHandler", "showHide();", true);
 
 
 
 </script>

Open in new window

0
 
jianxin9Author Commented:
This works great....now it's just trying to work this in with what I already have.  Let me see if I can.
0
 
sm394Commented:
glad your problem resolved :)
0
 
jianxin9Author Commented:
Okay when I try to put it all together, I am getting this error.  I am going to go ahead and place my entire code on here if that is okay.  I do appreciate the help.

urred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

 Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The ID 'txtName' is already used by another control.

Source Error:

Line 234:
Line 235:          
Line 236:                Please tell us what school you are from if you are a guest user: <asp:TextBox runat="server" ID="txtName"></asp:TextBox>
Line 237:                        Portal Username: (optional)<br />
Line 238:                        <asp:TextBox ID="portal_id" runat="Server" />
<%@ Page Language="c#" Debug="true"%>
 
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Net.Mail" %>
<%@ Import Namespace="System.Net" %>
 
<script runat="server" language="C#">
		 
 
  void Page_Load()
  {
      if (Page.IsPostBack)
      {
          questionsPanel.Visible = false;
          Message.Visible = true;  
          int correct = 0;
          if (q1.SelectedIndex == 2) correct++;
          if (q2.SelectedIndex == 4) correct++;
          if (q3.SelectedIndex == 2) correct++;
          if (q4.SelectedIndex == 0) correct++;
          if (q5.SelectedIndex == 5) correct++;
          if (q6.SelectedIndex == 1) correct++;
          if (q7.SelectedIndex == 2) correct++;
 
          LoadConn(correct);
      }
      else
      {
          questionsPanel.Visible = true;
          Message.Visible = false;  
      }
  }
 
private void LoadConn(int score)
{
    int percent;
    percent = (score*100)/7;  
  
    // Create the objects 
    OleDbConnection conn;
    OleDbCommand comm;
    
    // Instance the connection open it
    conn = new OleDbConnection("Provider = Microsoft.ACE.OLEDB.12.0; Data Source ="+ Server.MapPath("")+";User Id=; Jet OLEDB:Database Password=;");
    conn.Open();
    
    // Create the insert SQL 
    string sSQL = "";
		string qname = "plagiarism"; 
    sSQL = "Insert into posttest_table(fname,lname,username,coursenum,emailId,emailId2,statusCheckName,txtName,qname,answered,score,q1,q2,q3,q4,q5,q6,q7) values('" + fname.Text + "','" + lname.Text +"','" + portal_id.Text +"','"+course_id.Text+"','"+emailId.Text+"','"+emailId2.Text+"','"+(statusCheckName.SelectedIndex+1)+"','"+ txtName.Text +"','"+(qname)+"',"+score+","+percent+","+(q1.SelectedIndex+1)+","+(q2.SelectedIndex+1)+","+(q3.SelectedIndex+1)+","+(q4.SelectedIndex+1)+","+(q5.SelectedIndex+1)+","+(q6.SelectedIndex+1)+","+(q7.SelectedIndex+1)+");";
   
    //  Response.Write(sSQL + "<br />");
    //  Response.End();
    //  return;
    
    // Create a command object from the connection
    comm = conn.CreateCommand ();
    comm.CommandText = sSQL;
    comm.CommandType = CommandType.Text;
 
    // Try the insert 
    try
    {
        comm.ExecuteNonQuery();
    }
    catch (Exception ex)
    {
        Response.Write("Error During DB Update: " + ex.ToString());
    }
    
    
   
    conn.Close();
    // Inserting data into the database end
     
    // Create the email body text
/* String bodyInfo = fname.Text+" "+lname.Text+" has taken the exam.\n <br />"+fname.Text  +" has scored: "+percent+" out of 100 and gotten "+score+" out of 7 questions correct.\n<br /><br />"+fname.Text  +"'s options were: \n<br /> Question 1. Plagiarism is the act of: <br />The correct answer is: using someone else's work and not giving them credit (Option 3)<br /> You Answered:  Option "+(q1.SelectedIndex+1)+"\n <br /><br />Question 2.  Which of the following is copyrighted infringement? <br />The correct answer is: all of the above (Option 5) <br />You Answered: Option "+(q2.SelectedIndex+1)+"\n <br /><br />Question 3.  Accidental plagiarism is: <br />The correct answer is: always unacceptable (Option 3) <br />You Answered: Option "+(q3.SelectedIndex+1)+"\n <br /><br />Question 4. When citing my resources it is important that I: <br />The correct answer is: use a standard citation format assigned by your professor (Option 1) <br />You Answered: Option "+(q4.SelectedIndex+1)+"\n <br /><br />Question 5. RefWorks can help you: <br />The correct answer is: a, c, d (Option 6) <br />You Answered: Option "+(q5.SelectedIndex+1)+"\n<br /><br /> Question 6. Which of the following best describes plagiarism?  <br />The correct answer is: It's a serious offense and can result in severe penalties (Option 2) <br />You Answered: Option "+(q6.SelectedIndex+1)+"\n<br /><br /> Question 7. When do you have to cite your resources? <br /> The correct answer is: when what you are writing about is someone else's idea (Option 3) <br /> You Answered: Option "+(q7.SelectedIndex+1);*/
 
 String bodyInfo = fname.Text+" "+lname.Text+" is a/an "+statusCheckName.Text+", and has taken the exam for the course "+course_id.Text+".\n <br />"+fname.Text+" has scored: "+percent+" out of 100 and gotten "+score+" out of 7 questions correct.\n<br /><br />"+fname.Text  +"'s options were: \n<br /> Question 1. Plagiarism is the act of: <br />The correct answer is: using someone else's work and not giving them credit (Option c)<br /> You Answered:  Option "+Convert.ToChar(q1.SelectedIndex+97)+"\n <br /><br />Question 2.  Which of the following is copyrighted infringement? <br />The correct answer is: all of the above (Option e) <br />You Answered: Option "+Convert.ToChar(q2.SelectedIndex+97)+"\n <br /><br />Question 3.  Accidental plagiarism is: <br />The correct answer is: always unacceptable (Option c) <br />You Answered: Option "+Convert.ToChar(q3.SelectedIndex+97)+"\n <br /><br />Question 4. When citing my resources it is important that I: <br />The correct answer is: use a standard citation format assigned by your professor (Option a) <br />You Answered: Option "+Convert.ToChar(q4.SelectedIndex+97)+"\n <br /><br />Question 5. RefWorks can help you: <br />The correct answer is: a, c, d (Option f) <br />You Answered: Option "+Convert.ToChar(q5.SelectedIndex+97)+"\n<br /><br /> Question 6. Which of the following best describes plagiarism?  <br />The correct answer is: It's a serious offense and can result in severe penalties (Option b) <br />You Answered: Option "+Convert.ToChar(q6.SelectedIndex+97)+"\n<br /><br /> Question 7. When do you have to cite your resources? <br /> The correct answer is: when what you are writing about is someone else's idea (Option c) <br /> You Answered: Option "+Convert.ToChar(q7.SelectedIndex+97);
 
 
    // Create SMTP client
    SmtpClient client = new SmtpClient("");
        
    // Create SMTP message
    MailMessage message = new MailMessage();
 
    // Set message properties 
    message.From = new MailAddress ("");
    message.To.Add("");
     if (!string.IsNullOrEmpty(emailId.Text))
    {
       message.CC.Add(emailId.Text);
    }
   if (!string.IsNullOrEmpty(emailId2.Text))
    {
       message.CC.Add(emailId2.Text);
    }
    message.Body = bodyInfo;
    message.Subject = "Doing Research: Plagiarism Quiz Results";
    message.IsBodyHtml = true;
   
    try
        {
 
            // Send EMail
            client.Send(message);
        }
        catch (Exception ex)
        {
            // Do Nothing  
        }
				
 
    // Send the user to the Results page
    Response.Redirect("results.aspx?fname="+fname.Text+"&lname="+lname.Text+"&score="+percent+"&q1="+(q1.SelectedIndex)+"&q2="+(q2.SelectedIndex)+"&q3="+(q3.SelectedIndex)+"&q4="+(q4.SelectedIndex)+"&q5="+(q5.SelectedIndex)+"&q6="+(q6.SelectedIndex)+"&q7="+(q7.SelectedIndex));
 
}
 
  protected void Page_Load(object sender, EventArgs e)
    {
        statusCheckName.Attributes.Add("onclick", "showHide();");
        Page.ClientScript.RegisterStartupScript(this.GetType(), "OnLoadHandler", "showHide();", true);
    }
 
 
 
 
 
 </script>
 
   
 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Doing Research: Plagiarism Quiz</title>
    <meta name="Description" content="Texas Woman's University, with campuses in Denton, Dallas, and Houston, offers bachelor's, master's, and doctoral degrees to its students in the health sciences, the liberal arts, the fine arts, the sciences, and business." />
    <meta name="Keywords" content="texas woman's university, TWU, web guidelines, webspinners" />
    <link href="http://www.twu.edu/library/css/screen.css" rel="stylesheet" type="text/css" media="screen" />
    <link href="http://www.twu.edu/library/css/print.css" rel="stylesheet" type="text/css" media="print" />
    <link href="http://www.twu.edu/library/css/all2_tab.css" rel="stylesheet" type="text/css" media="screen" />
    <script type="text/javascript" src="http://www.twu.edu/library/js/TAB_Function_Lib.js"></script>
 
 
   <script type="text/javascript" language="javascript">
        function showHide() {
            var rows = document.getElementById('<%= statusCheckName.ClientID %>').getElementsByTagName("input");
 
            if (rows[3].checked)
                document.getElementById('<%=txtName.ClientID%>').style.display = "block";
            else
                document.getElementById('<%= txtName.ClientID%>').style.display = "none";
        }
 
 
        function isValidName(sender, args) {
            var rows = document.getElementById('<%= statusCheckName.ClientID %>').getElementsByTagName("input");
 
            if (rows[3].checked) {
                var txt = document.getElementById('<%=txtName.ClientID%>');
                args.IsValid = (txt.value.length > 0);
            }
        }
    </script>
 
 
 
 
 
 
    <style type="text/css">
        #Layer1 {
	        position:absolute;
	        width:186px;
	        height:18px;
	        z-index:3;
	        left: 407px;
	        top: 85px;
        }
        #Layer2 {
	        position:absolute;
	        width:421px;
	        height:30px;
	        z-index:4;
	        left: 603px;
	        top:78px;
        }
        .style1 {
	        font-size: 10px;
x	        color: #FFFFFF;
        }
        .style2 {font-size: 10px}
    </style>
</head>
 
 <body onUnload="TAB_GLOBAL_UNINITIALIZE(Array(Example));">
 
    </div>
<!-- InstanceBeginEditable name="content" -->
     <h2>Doing Research: Plagiarism Final</h2>
 <div class="heading">Please Enter Your Information</div>
<Fieldset>
<legend>Please provide the following. Items marked with * are required.</legend>
<form id="Form1" name="ctl00" method="post" action="default.aspx" runat="server">
                    <asp:label id="Message" runat="server" />
 
                        <asp:Panel id = "questionsPanel" runat ="server">
                        <asp:Label ID="Errors" runat="server" />
                        First Name:*<br />
                        <asp:TextBox ID="fname" runat="Server" /><br />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="fname"
                            ErrorMessage="First Name" runat="server" Text="*First Name Required"></asp:RequiredFieldValidator>
                        <br />
                        Last Name:*<br />
                        <asp:TextBox ID="lname" runat="Server" /><br />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="lname"
                            ErrorMessage="Last Name" runat="server" Text="*Last Name Required"></asp:RequiredFieldValidator>
                        <br />
				
    <asp:CustomValidator ValidationGroup="Group2" ID="schoolName" runat="server" ClientValidationFunction="isValidName"
            ErrorMessage="If you are a guest, please enter your school name."></asp:CustomValidator>
        <asp:RadioButtonList ID="statusCheckName" RepeatDirection="Horizontal" runat="server">
				<asp:ListItem Value="undergrad">undergraduate</asp:ListItem>
            <asp:ListItem Value="grad">graduate</asp:ListItem>
            <asp:ListItem Value="fs">faculty/staff</asp:ListItem>
            <asp:ListItem Value="guest">guest user</asp:ListItem>
        </asp:RadioButtonList>
        Please tell us what school you are from if you are a guest user:
        <asp:TextBox runat="server" ID="txtName"></asp:TextBox>
 
           
                Please tell us what school you are from if you are a guest user: <asp:TextBox runat="server" ID="txtName"></asp:TextBox>
                        Portal Username: (optional)<br />
                        <asp:TextBox ID="portal_id" runat="Server" />
                        <br />
                        <br />
												Course Name, Number and Section: (optional-ex. ENG-1023.15)<br />
                        <asp:TextBox ID="course_id" runat="Server" />
                        <br />
                        <br />
                        Your Email Address:* (a copy of your results will be sent to this address)<br />
                        <asp:TextBox ID="emailId" runat="Server" />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator5" ControlToValidate="emailId"
                            ErrorMessage="Email" runat="Server" Text="*Email Address Is Required"></asp:RequiredFieldValidator><br />
                        <br />
                        Your Professor's Email Address: (optional-send your results to your professor)<br />
                        <asp:TextBox ID="emailId2" runat="Server" />
                        <br />
                        <p>
              
             
										  Please choose the best answer.</p>
                        <p>
                            1. Plagiarism is the act of:
                            <br />
                            <asp:RadioButtonList ID="q1" runat="server">
                                <asp:ListItem id="q1a" runat="server" Value="a. using someone else's work and citing it" />
                                <asp:ListItem id="q1b" runat="server" Value="b. using copyrighted materials for your paper" />
                                <asp:ListItem id="q1c" runat="server" Value="c. using someone else's work and not giving them credit" />
                                <asp:ListItem id="q1d" runat="server" Value="d. paraphrasing" />
                            </asp:RadioButtonList>
                        </p>
                        <p>
                            2. Which of the following is copyrighted infringement?
                            <br />
                            <asp:RadioButtonList ID="q2" runat="server">
                                <asp:ListItem id="q2a" runat="server" Value="a. photocopying a college textbook" />
                                <asp:ListItem id="q2b" runat="server" Value="b. burning a CD that you did not own" />
                                <asp:ListItem id="q2c" runat="server" Value="c. downloading music or movies that you did not pay for" />
                                <asp:ListItem id="q2d" runat="server" Value="d. buying and submitting papers that you did not write" />
                                <asp:ListItem id="q2e" runat="server" Value="e. all of the above" />
                            </asp:RadioButtonList>
                        </p>
                        <p>
                            3. Accidental plagiarism is:
                            <br />
                            <asp:RadioButtonList ID="q3" runat="server">
                                <asp:ListItem id="q3a" runat="server" Value="a. acceptable one time, as long as it was only an accident" />
                                <asp:ListItem id="q3b" runat="server" Value="b. okay if you paraphrased or changed the text a bit" />
                                <asp:ListItem id="q3c" runat="server" Value="c. always unacceptable" />
                            </asp:RadioButtonList>
                        </p>
                        <p>
                            4. When citing my resources it is important that I:
                            <br />
                            <asp:RadioButtonList ID="q4" runat="server">
                                <asp:ListItem id="q4a" runat="server" Value="a. use a standard citation format assigned by your professor" />
                                <asp:ListItem id="q4b" runat="server" Value="b. include only the title and year" />
                                <asp:ListItem id="q4c" runat="server" Value="c. use footnotes, in-text citations, and italics for every citation" />
                                <asp:ListItem id="q4d" runat="server" Value="d. all of the above" />
                            </asp:RadioButtonList>
                        </p>
                        <p>
                            5. RefWorks can help you:
                            <br />
                            <asp:RadioButtonList ID="q5" runat="server">
                                <asp:ListItem id="q5a" runat="server" Value="a. organize your research" />
                                <asp:ListItem id="q5b" runat="server" Value="b. only when you are using the MLA citation style" />
                                <asp:ListItem id="q5c" runat="server" Value="c. import references from many different data sources" />
                                <asp:ListItem id="q5d" runat="server" Value="d. create bibliographies using several citation styles" />
                                <asp:ListItem id="q5e" runat="server" Value="e. all of the above" />
                                <asp:ListItem id="q5f" runat="server" Value="f. a, c, d" />
                            </asp:RadioButtonList>
                        </p>
                        <p>
                            6. Which of the following best describes plagiarism?
                            <br />
                            <asp:RadioButtonList ID="q6" runat="server">
                                <asp:ListItem id="q6a" runat="server" Value="a. A temporary fix until you have time to re-do the work" />
                                <asp:ListItem id="q6b" runat="server" Value="b. It's a serious offense and can result in severe penalties" />
                                <asp:ListItem id="q6c" runat="server" Value="c. It's easy to commit and not easy to detect" />
                                <asp:ListItem id="q6d" runat="server" Value="d. a and b" />
                            </asp:RadioButtonList>
                        </p>
                        <p>
                            7. When do you have to cite your resources?
                            <br />
                            <asp:RadioButtonList ID="q7" runat="server">
                                <asp:ListItem id="q7a" runat="server" Value="a. when what you are writing about is your own experience" />
                                <asp:ListItem id="q7b" runat="server" Value="b. when what you are writing about is common knowledge" />
                                <asp:ListItem id="q7c" runat="server" Value="c. when what you are writing about is someone else's idea" />
                            </asp:RadioButtonList>
                        </p>
                     
												
  <asp:Button ID="b1" Text="Submit" runat="server" />
                        <asp:ValidationSummary ID="ValidationSummary1" ValidationGroup="Group2" ShowMessageBox="true" ShowSummary="false"
                            HeaderText="You must enter a value in the following fields:" EnableClientScript="true"
                            runat="server" />
                     </asp:Panel>
                   </form>
 <!-- InstanceEndEditable --></td>
  </tr>
  <tr>
    <td id="footer"></td>
  </tr>
</table>
 
 
</body>
<!-- InstanceEnd -->
</html>

Open in new window

0
 
jianxin9Author Commented:
Sorry, I found the error.  I had the line with "txtName" listed twice.  Okay, when the textbox appears I am still able to submit without filling it in.  I think I am still having trouble with the validator.  I have two, the custom one and my other one.  Can I get it to work?

Thanks again for all of your help--I am actually close! :)


    <asp:CustomValidator ValidationGroup="Group2" ID="schoolName" runat="server" ClientValidationFunction="isValidName"
            ErrorMessage="If you are a guest, please enter your school name."></asp:CustomValidator>
 
<asp:ValidationSummary ID="ValidationSummary1" ShowMessageBox="true" ShowSummary="false"
                            HeaderText="You must enter a value in the following fields:" EnableClientScript="true"
                            runat="server" />
                     </asp:Panel>

Open in new window

0
 
jianxin9Author Commented:
Also, when the box appears, can I make this text appear with the box?

 Please tell us what school you are from if you are a guest user:
0
 
jianxin9Author Commented:
I am going to post those as new questions.  Thanks again--you've been a huge help!
0
 
jianxin9Author Commented:
THANK YOU!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.