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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:09:40+00:00 2026-05-11T19:09:40+00:00

Here is the problem: My page displays a set of items. Each item has

  • 0

Here is the problem:

My page displays a set of items. Each item has a check box associated to it (which is part of a form). User might check any of these check boxes and press ‘Delete’ button. The same page also has a ‘Upload’ button which would upload an excel sheet of items.
At the moment, my form action sumbits to say : “xyzAction” and I have two different handlers (analogous to Struts Action) – one for deletion of stores and other for uploading stores.

I am told that the best way to do this is to rely on javascript by doing one of these:
1)) Switching form action on press of upload and delete buttons – there by invoke different actions.
2) Use a hidden variable “act” to set it to delete / upload and submit to a single form. The server side action would take care of identifying the act and forwarding to the corresponding action.

Approach (1) – seems very inelegant to me. Playing with form action seems unnecessary.
Approach (2) – would obviously not work if your javascript is turned off and is not very elegant either.

There must be a third way to doing this?, which would make me happy?

  • 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-11T19:09:41+00:00Added an answer on May 11, 2026 at 7:09 pm

    You need to get the HTML correct first.

    You have two different actions, so you should have two forms – a good rule of thumb is that each form should only have one submit button. This is the best practice for HTML and will ensure that the page works without JS or any other trickery.

    Once you have the page working like this, use JS to manipulate the DOM to produce the UI that you need. This is using JS to add behvour to the UI and is best practice for unobtrusive JS.

    (If you really want to conflate your actions in a single form, changing the action of the form with JS is the best course of action. But consider what would happen if a user checks a check box and then changes their mind and uploads a file leaving the checkbox checked. You should take care that this shouldn’t delete anything.)

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

Sidebar

Related Questions

Maddening problem here. When my page loads: <body onload=getClientDateTime();> It runs this function: document.getElementById('ClientDateTime').value=hello
here's my problem, my footer dont stay at the bottom of the page. I
I have a Session which I am using to hold items in a form
I've created a working MVC page which brings back a set of data that
I'm using php to generate an html page that displays blog/thread items, and I
I am including jQuery in background_page like this, <script type=text/javascript src=libs/jquery.js></script> Here's the problem:
The problem here is how to add an NSPopUpButton in Xcode 4's Interface Builder
date here my problem: String datetime = 2012-03-24 23:20:51; I know that that string
Super weird problem here. I'm having trouble getting jQuery to bind any selectors except
I have a problem here im trying to upload a file first time 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.