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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:28:05+00:00 2026-06-04T07:28:05+00:00

I have a single form on my page with two ways of submitting it.

  • 0

I have a single form on my page with two ways of submitting it. The first is an anchor tag and the other is a submit button, both of them having different behaviours.

How can I assign to each a separate action method? Thanks.

  • 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-04T07:28:07+00:00Added an answer on June 4, 2026 at 7:28 am

    It really depends on what the anchor tag does – presumably it’s triggering a submit in javascript?

    If it’s actually just doing a GET instead of a POST, then you can do as @dbaseman suggests – have separate action methods for the two request types.

    But if the anchor does javascript submit, then my preference would be to simply give the submit button a name so you can detect it on the server in one action method, and then fork the code from there:

    <submit name="fromButtom" value="Submit" />
    

    And then your action method:

    public ActionResult Foo(string fromButton)
    {
      //if 'fromButton' contains 'Submit' then you assume it was the button.
    }
    

    Even better you can use a <button> instead, and then you can divorce the displayed text from the value that the button submits (useful if you’re localising the page):

    <button name="submitMethod" value="fromButton">Submit</button>
    

    Now you can have a submitMethod parameter on your action method, in which you look for 'fromButton'.

    Either way – the anchor tag/javascript (if that’s how you’re doing it) won’t submit this value, because the button’s value is only submitted when it’s clicked.

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

Sidebar

Related Questions

I have two div tags in single HTML with data-role as 'page'. First one
I have two forms on a single page and I want to submit the
I have two forms on my page. I want to submit one form only.
I have a single text box with no submit button on form as below
I have two forms on a single page. One is just a form for
I have A single page that has the following structure <form runat=server><placeholder></placeholder></form> I have
Assume we have a single Windows form with a button called SimpleButton1. The following
I have a simple form with a single button and a datatable with a
I have a page with a single form on it. The form contains a
I have two types of roles [Admin, HelpDeskAdmin]. I have a single logon view(both

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.