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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:52:09+00:00 2026-05-31T07:52:09+00:00

Coding standards in place mean I do not have an option of using ajax

  • 0

Coding standards in place mean I do not have an option of using ajax for this.

A user is logged in and the SESSION keeps track of him/her. At login, their list of
ancient human artifacts are retrieved (server-side) from mysql and a heredoc displays them
in rows of divs — each div is a row with one artifact – here are two div rows:

     'bronze-age tool' 'egypt'   'photo: tool3_found_1964-Feb_dig.jpg'
     'decorated bowl'   'Shang Dynasty/China'  'photo: shang-bowl.png'

A list of these artifacts that the user uploaded previously is displayed in a heredoc
set of rows of divs.

The list of divs is not a form. I could make each row (each artifact) a form to solve
my problem but it seems kludgy. The user must be able to click on a div to select and
highlight that artifact in the row of divs (and select/highlight part I’ve already got
working, it’s all client-side javascript of course).

A ‘delete’ button above the rows of divs is then changed from disabled to enabled.

When the ‘delete’ button is clicked I need to hit the server, give it the selected div’s artifact,
and the server already knows the logged-in user (they’re in the SESSION) and then the server must
delete that artifact and when the page reloads, BAM that artifact’s row is now gone from the above
list of artifacts divs.

If I make each div-row artifact a form, in my onclick handler for that div-row, I could
programmatically submit() that div-row form (using javascript) to delete that artifact and that would work.

But making each div its own form stylistically sucks imo.

I could make the entire heredoc set of divs a form. But then, on submit,
because only one div-row is to be deleted, the server would be given a potentially large
set of divs, only one of which is the ‘selected’ div to be deleted, and would have to
traverse the POST array and somehow find the ‘selected’ div out of the large set of divs
in the POST array.

At least if each div-row of a selected artifact was a form unto itself, the POST array
would only contain the one div’s contents — the selected div the user wants deleted —
and then the server immediately knows which mysql record to remove (the selected div
artifact) without have to traverse a potentially huge form of divs, only one of the
divs being the one to delete.

Besides the ‘entire heredoc is a form’ and ‘each div is a form and a programmatic submit()
deletes the selected div’ — is there a better way to make this happen I’m not seeing?

  • 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-05-31T07:52:10+00:00Added an answer on May 31, 2026 at 7:52 am

    Create a form outside your list, with a hidden input field for the artifact id. In the onclick for the delete buttons, update that hidden field and submit the form.

    Form:

    <form id="delete_artifact_form" action="delete_action" method="post">
        <input type="hidden" name="artifact_id" id="delete_artifact_id" />
    </form>
    

    Delete function:

    function delete_artifact( id ) {
        document.getElementById( "delete_artifact_id" ).value = id;
        document.getElementById( "delete_artifact_form" ).submit( );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The .NET coding standards PDF from SubMain that have started showing up in the
We implemented new coding standards, which call for our private members to have a
To ensure coding standards I have a couple of unit test which uses reflection
here C programming Guidelines and coding standards says we have to avoid magic numbers
It's more of a coding standards question this one. Which one is, if I
The coding standards at my company have changed such that the function declaration void
I have C# application we've been coding in ADO.NET. I've been using the IDbCommand
I prefer coding standards to be logical. This is my argument for why the
I have been given to the task of writing a coding standards document and
Our coding standards ask that we minimise the use of C# var (suggests limiting

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.