Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8236487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:09:00+00:00 2026-06-07T19:09:00+00:00

Here is my form: <form id=Test action=index.php?course=4 method=post name=Test onSubmit=IsFormComplete(12)> Inside the form is

  • 0

Here is my form:

<form id="Test" action="index.php?course=4" method="post" name="Test" onSubmit="IsFormComplete(12)">  

Inside the form is a table dynamically generated with id=Qx class=Qx where x is 1 through 12:

 <tr id="Q2" class="Q2">  
            <td width="5%">2) </td>  
            <td colspan="2">According to the Institute of Medicine study the number of deaths from medical errors per year is between</td>  

Here is my javascript function:

function IsFormComplete(iQuestions) {  
var questionNum = iQuestions;  
    itemOkay=true;  
    for (var i=1;i<questionNum;i++) {  
        for (var j=0;j<4;j++) {  
            var thisItem = eval("document.Test.Q" + i + "[" + j + "].checked");  
            if (!thisItem)  {  
                itemOkay = false;  
                document.getElementById(eval("Q" + i)).style.color = "red";  
            }  
        }  
    }  
    alert("item okay = " + itemOkay);  
    if (itemOkay) {  
        return true;  
    } else {  
        return false;  
    }  

}

Not working PLEASE help. New to DOM and have tried various tags:

document.getElementById(eval("Q" + i)).style.color = "red";  
document.Test.getElementById(eval("Q" + i)).style.color = "red";  
document.getElementById("Q1").style.color = "red";  //To try literal instead of variable

etc.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T19:09:02+00:00Added an answer on June 7, 2026 at 7:09 pm

    You don’t need the eval. getElementById uses a string. Try this:

    document.getElementById("Q"+i).style.color = "red";  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a login page using spring_security_check. Here: <form name='f' action=/sec_test/j_spring_security_check method='POST'> <table> <tr>
I'm experiencing a very odd upload problem. Here's the relevant view file: <form action=http://localhost/index.php/temp/upload/
I can't seem to submit a form via POST with PHP over SSL. Here's
Here is a simple form I am using to send XML data in admin_xml.php
I have my index page INDEX.html and a PHP page TEST.php then an autosuggest
I'm trying to send POST data to a test.php file, which handles POST data
I modified this simple countdown timer form here: https://github.com/lunaryorn/snippets/blob/master/qt4/countdown.py as follows. Now I want
To give more information I am using the modular form here: http://jqueryui.com/demos/dialog/#modal-form `b(e.target).zIndex` is
I've been putting together my first Ajax powered form ( here ), with the
Summary Below is the full question (a bit complicated in its full form) here's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.