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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:29:25+00:00 2026-06-16T02:29:25+00:00

I have created a table that allows a user to edit/correct the data. The

  • 0

I have created a table that allows a user to edit/correct the data. The table populates fine, and in order to make this table as easy to use as possible. I have added drop down boxes that they can select from when they need to change any information.

JS file is:

for(y=0;y<data.defect2.length; y++) {
    myselectoptions += '<option value="'+data.defect_id[y]+'"' +
        (data.defect_id[y]==data.defect[y] ? ' selected="selected"' : '') + 
        '>'+data.defect2[y]+'</option>';
}

if (data.isbn2 === null) {
    $("#inventoryUpdate").append('<tr><td>No Records Found</td></tr>');
} else {
    for(var x=0;x<data.isbn2.length;x++) {
        $("#inventoryUpdate").append('<tr><td id="tableSKU">'+data.sku[x]+'</td><td id="tableISBN">'+data.isbn2[x]+
        '</td><td id="tableQuantity">'+data.quantity[x]+
        '</td><td><select id="tableDefect">'+myselectoptions+//'" selected="'+data.defect[x]+'">'+myselectoptions2+
        '"</select></td><td><select id="tableSource">'+sourceoptions+
        '"</select></td><td><select id="tableFeature">'+featureoptions+
        '"</select></td><td><select id="tableWater">'+wateroptions+
        '"</select></td><td><select id="tableLocation">'+locationoptions+
        '"</select></td><td><input type="text" id="tableProcessDate" value="'+data.processDate[x]+
        '"/></td><td><select id="tableBookType">'+bookoptions+
        '"</select></td><td><select id="tableCreatedBy">'+useroptions+
        '"</select></td><td><select id="tableModifiedBy">'+useroptions+
        '"</select></td></tr>');
    }

    $("#inventoryUpdate").trigger("update");
}

This all works, except that I can’t have it default to the selected item from the database query. The item that is selected is the value of the very last item in the table.
Any ideas on how to accomplish this or is it impossible to do?

  • 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-16T02:29:27+00:00Added an answer on June 16, 2026 at 2:29 am

    Well it took some doing but I finally figured it out. I needed to put the

    for(y=0;y<data.defect2.length; y++) {
         myselectoptions += '<option value="'+data.defect_id[y]+'"' +
             (data.defect_id[y]==data.defect[x] ? ' selected="selected"' : '') + '>'+data.defect2[y]+'</option>';
    } 
    

    inside of the

    if(data.isbn2 === null){
        $("#inventoryUpdate").append('<tr><td>No Records Found</td></tr>');
    } else {
        for(var x=0;x<data.isbn2.length;x++) {
            $("#inventoryUpdate").append('<tr><td id="tableSKU">'+data.sku[x]+'</td><td id="tableISBN">'+data.isbn2[x]+
                '</td><td id="tableQuantity">'+data.quantity[x]+
                '</td><td><select id="tableDefect">'+myselectoptions+//'" selected="'+data.defect[x]+'">'+myselectoptions2+
                '"</select></td><td><select id="tableSource">'+sourceoptions+
                '"</select></td><td><select id="tableFeature">'+featureoptions+
                '"</select></td><td><select id="tableWater">'+wateroptions+
                '"</select></td><td><select id="tableLocation">'+locationoptions+
                '"</select></td><td><input type="text" id="tableProcessDate" value="'+data.processDate[x]+
                '"/></td><td><select id="tableBookType">'+bookoptions+
                '"</select></td><td><select id="tableCreatedBy">'+useroptions+
                '"</select></td><td><select id="tableModifiedBy">'+useroptions+
                '"</select></td></tr>');
        }
    }
    

    so the final product looks like this:

    if(data.isbn2 === null){
        $("#inventoryUpdate").append('<tr><td>No Records Found</td></tr>');
    } else {
        for(var x=0;x<data.isbn2.length;x++) { 
            for(y=0;y<data.defect2.length; y++) {
                myselectoptions += '<option value="'+data.defect_id[y]+'"' +
                    (data.defect_id[y]==data.defect[x] ? ' selected="selected"' : '') +
                    '>'+data.defect2[y]+'</option>';
            } 
    
            $("#inventoryUpdate").append('<tr><td id="tableSKU">'+data.sku[x]+'</td><td id="tableISBN">'+data.isbn2[x]+
                '</td><td id="tableQuantity">'+data.quantity[x]+
                '</td><td><select id="tableDefect">'+myselectoptions+//'" selected="'+data.defect[x]+'">'+myselectoptions2+
                '"</select></td><td><select id="tableSource">'+sourceoptions+
                '"</select></td><td><select id="tableFeature">'+featureoptions+
                '"</select></td><td><select id="tableWater">'+wateroptions+
                '"</select></td><td><select id="tableLocation">'+locationoptions+
                '"</select></td><td><input type="text" id="tableProcessDate" value="'+data.processDate[x]+
                '"/></td><td><select id="tableBookType">'+bookoptions+
                '"</select></td><td><select id="tableCreatedBy">'+useroptions+
                '"</select></td><td><select id="tableModifiedBy">'+useroptions+
                '"</select></td></tr>');
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table that's created like this: CREATE TABLE bin_test (id INTEGER PRIMARY
I have an app that allows a user to enter and edit projects in
I have created a table in Visual Studio. That table has two columns. First
We have created a table with a trigger that updates a ModifiedDate field in
I have created a table in my Ruby on Rails application that I am
My issue is that I have created a table for a local db in
I have a table that I created within xcode so there is no nib
I have created a web page that displays a table. Most of the cells
I have created a web page that displays a table. Most of the cells
I have a table that contains id, created, user_id. I'm wondering if there is

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.