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

  • Home
  • SEARCH
  • 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 9208723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:40:42+00:00 2026-06-18T00:40:42+00:00

Here’s the function that checks if the form is complete. So, what I’m trying

  • 0

Here’s the function that checks if the form is complete.

So, what I’m trying to do:

  1. If radio is not selected, throw a message.
  2. If radio is “yes”, but text is not entered, throw error.
  3. If radio is “no” but text is entered, make the text empty.
  4. If all is good, add stuff into `allResponses

The form was displayed 5 times, and input was as follows:

Yes a1

No

Yes a3

No

Yes 

Now, this input should display an error since in 5th case, “yes” is selected but nothing is entered in the textbox.

However, I get this:

https://i.stack.imgur.com/NXMDl.png

Also, the text is not being updated as in 1st and 3rd cases.

I don’t know a lot about JS, so please provide me with as explained responses as you can.

EDIT: Complete code: http://pastebin.com/scNSNM2H

Thanks

  • 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-18T00:40:43+00:00Added an answer on June 18, 2026 at 12:40 am

    You have this in a loop:

    var exaggerationPart = document.getElementById('exaggeration').value
    

    And then you check to make sure it has a value for each item. But you will get the same value each time.

    You are creating multiple inputs with the same id, “exaggeration”. This is invalid HTML. Id’s must be unique. To correct this, you can increment the id the same as you are doing with other elements (such as, input[name='response"+thisJokeIndex+"']).

    var exaggerationPart = document.getElementById('exaggeration' + thisJokeIndex).value
    
    tipTD2.append("<input type='text' name='exaggeration' id='exaggeration" + tipIndex + "' size='70'>")
    

    Working demo: jsfiddle.net/svvge/2

    Edit: To clear the value of the text box, you must change the value property of the text box element. Right now you are just changing the value of a variable.

    var exaggerationInput = document.getElementById('exaggeration' + thisJokeIndex).value;
    var exaggerationPart = exaggerationInput.value;
    
    exaggerationInput.value = '';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is an object that I'd like to use with ng-repeat, but it's not
Here is the code in a function I'm trying to revise. This example works
Here is the code: create table `team`.`User`( `UserID` bigint NOT NULL AUTO_INCREMENT , `Username`
Here is the Javascript I currently have <script type=text/javascript> $(function() { $('.slideshow').hover( function() {
Here is my SQL script CREATE TABLE tracks( track_id int NOT NULL AUTO_INCREMENT, account_id
Here's my problem I have this javascript if (exchRate != ) { function roundthecon()
Here's my function: static Map AddFormation(Map _map, Tile tile, int x, int y, int
Here is my javascript code for a cursor focus function to go to username
Here's the setup - I have a view that lists products. On that same
Here is the situation. I am making changes to an application but I do

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.