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 8456031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:26:32+00:00 2026-06-10T12:26:32+00:00

I have this form in my page: <form:form id=addUnitForm method=POST modelAttribute=questionUnit> <fieldset> <label for=questionText>Question</label>

  • 0

I have this form in my page:

<form:form id="addUnitForm" method="POST" modelAttribute="questionUnit">
    <fieldset>
        <label for="questionText">Question</label> <input type="text"
            id="questionText" class="required" value="${questionContent[0] }" /><br/>
       Answers
        <c:forEach var="i" begin="1" end="${questionContentSize-1 < 0 ? 0 : questionContentSize-1 }">
            <div id="answerRow">
                <input type="text" id="questionAnswer" name="questionAnswer${i }" class="required" value="${questionContent[i] }"/>
                <input type="checkbox" id="questionAnswerCheckbox" ${answerContent.contains(questionContent[i]) ? 'checked="checked"' : ''}/> 
                <input type="button" id="removeAnswer" value="x" />
            </div>
        </c:forEach>
    </fieldset>
    <input type="submit" value="OK" />
    <input type="button" value="Add answer" id="Add_answer" />
</form:form>

now, when I had the same form, but without name attributes (only id’s) and every input element had the same value of id attribute and no name attribute, when I submited form only the field with questionText id got validated, the rest of them were not validated.

Now, I added unique names to every input with id of questionAnswer in my form, and everything works, so here are my 3 questions:

  1. how is it, that jquery validator validated questionText even, if there is no name attribute
  2. is the name attribute used internally by jquery validator to decide which elements should be validated?
  3. why, when I have more then one row with questionAnswer inputs, there is an error message near first row, no matter which row I left empty?

EDIT: here it is the form code from browser

    <fieldset>
    <label for="questionText">Question</label> <input type="text" value="" class="required valid" id="questionText"><br>
   Answers

<div id="answerRow">
  <input type="text" class="required valid" id="questionAnswer" name="questionAnswer0">
  <input type="checkbox" id="questionAnswerCheckbox">
  <input type="button" value="x" id="removeAnswer" class="ui-button ui-widget ui-state-default ui-corner-all" role="button" aria-disabled="false">
</div>
<div id="answerRow">
  <input type="text" class="required valid" id="questionAnswer" name="questionAnswer1">
  <input type="checkbox" id="questionAnswerCheckbox">
  <input type="button" value="x" id="removeAnswer" class="ui-button ui-widget ui-state-default ui-corner-all" role="button" aria-disabled="false">
  </div>
</fieldset>
  • 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-10T12:26:33+00:00Added an answer on June 10, 2026 at 12:26 pm

    1.how is it, that jquery validator validated questionText even, if there is no name attribute

    Because the element has the class required on it, which jQuery validate picks up.

    2.is the name attribute used internally by jquery validator to decide which elements should be validated?

    Yes it is.

    3.why, when I have more then one row with questionAnswer inputs, there is an error message near first row, no matter which row I left empty?

    Because jQuery validate cannot natively handle multiple elements with the same name (although there may be a plugin validator to handle this though) so it always assumes the error came from the first element in the document with the specified name, so puts the error there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this form: <form name=input action=http://s164074194.onlinehome.us/mail.py method=POST> Username: <input type=text name=email /> <input
I have this at the bottom of my page: <form id=Login method=post runat=server> <span
I have this form into PHP pages: echo "<form action=\"xxx.php\" method=\"post\" id=\"test\" name=\"test\"> <input
I have this form: <form name=commentform id=commentform action=comment.php method=post enctype=multipart/form-data> Your Name: <textarea maxlength=60
If I have this form which submits the post data to the page itself:
Let's say I have this form : <form action=Change-status.php method=post> <select class=changeStatus name=changeStatus> <option
I have form in my page, I am using ajax.beginform(). Inside this form I
I have this situation: There are a login page with a login form (form
I currently have a web form aspx page that calls RegisterClientScriptBlock. This sends down
I have a php page called form.php. When you go to this page it

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.