Solved

Enter only New Table Rows

Posted on 2010-11-15
2
304 Views
Last Modified: 2012-05-10
Now I need to make sure that I only enter each combination of select option and checkbox value once into the table and not multiple times. I am thinking I need to use contains().

Any help will save me time.

Thank you
sshivanna
0
Comment
Question by:sshivanna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
ID: 34136662
you need not search each and every value in the table. Just make sure that you give the id value of a  row based on the value of checkbox value, so that before adding the value in table you just need to check if an element based on that value exists or not, ie

if the value of selected checkbox is val1, then make sure that it always goes in row of id value tr_val1, so before creating a new row, just check if an element exists with the same name, by
var element = document.getElementById("tr_"+checkBoxValue);
if (element == null)
{
   alert("element does not exists, so this value is not in the table now");
}

hope this helps
0
 
LVL 2

Author Comment

by:sshivanna
ID: 34136930
That worked perfectly. Thank you.
0

Featured Post

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question