1

In conventional web application there is single action per one button click from user. So clicking on submit form, send email or change status, delete user etc all this does single action per page load then shows status message.

I am creating new application and trying to decide the likelihood of ever needing multiple actions that would run at one button click.

What would be some the case scenario where want I could use this functionality?

E.g. currently I have one action supported

index.php?action=login&username=admin&password=123

I could have possibly two actions at once, this might not be great example of need for two actions at one page refresh but this is my question when do I need this functionality?

index.php?action=login&username=admin&password=123&action2=download_news&url=whatever.com

P.S. perhaps this could be useful if my application receives input from remote server rather than user?

To be more clear I am asking not how to do multiple things without reloading page.

Is there use case for one button in app interface to run multiple system actions versus one action per button?

  • 1
    Off topic but just to mention; you shouldn't really have the password in the URL as that's typically saved in logs all over the place – Richard Tingle Dec 30 '16 at 10:55
1

Yes of course multiple actions can and sometimes should be taken with one button click. You might have a list of actions with check boxes. Or you might have a list of items on which you may act, with checkboxes indicating which ones should receive the action. A submit or "go" button could then launch the action.

If the actions taken are easily reversible, then you might not have a "go" button, instead having checking or unchecking the box immediately result in the action being done and undone via Ajax.

But if the actions are irreversible then the extra step of pressing "go" makes sense because you want the importance of the process to be clear.

Edit: I'll add a little more detail about how I implemented this. The checkboxes, when checked, obviously would change the submitted form variables. I structure the checkbox variables depending on what should take place on the backend. As you may know, in HTML you can use brackets in the name attribute to create an array of values in your backend code. I would then have a method that takes that array and acts on all the items. That method could apply the same kind of process to the array of items. Or the method could call other methods specified in the array, an array of actions.

|improve this answer|||||
2

There are a number of ways you can get more than one action out of a web page:

  1. Implement an API that talks to a JSON Web Service,
  2. Use AJAX, or
  3. Add a "method" parameter to your POST. In most MVC architectures, you get this capability for free.

In short, you need to learn a bit more about how all this works, and then the picture will become clearer to you.

|improve this answer|||||
0

A pretty common pattern in web applications is to redirect the user after a login rather than trying to complicate the logic by performing multiple actions in the same request. By default you redirect them to whatever your default landing page is but you have the option to set a target & send the user there instead.

|improve this answer|||||
0

It all depends on how big the scope of an 'action' is.

For example, consider a button used to register. And consider registering involves creating a user in DB, sending an email to the user, and add a cookie for later connections.

Would that be 3 actions, or one ? For most people, this is only one action since you're doing only one thing, registering as a user.

Now checkboxes. Consider a button to launch different algorithms on a bunch of stats. You can tick multiple checkboxes and thus, apply different algorithms to these stats.

Would that be X actions, or one ? Again, this only looks like you're doing one thing only, which is applying algorithms.

I don't think the HTML should be responsible for such low level thinking as to using different 'actions' (I'd call these 'methods' instead) even though it may feel more flexible.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.