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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:11:05+00:00 2026-06-10T09:11:05+00:00

We have form tags like below in our HTML pages: <form method= POST action=https://mysite_1.com>

  • 0

We have form tags like below in our HTML pages:

<form method= POST action=https://mysite_1.com> 
<input type=hidden name=XXXX value=yyyyyy> 
<input type=hidden name=YYYY value=zzzzz>
<input type=submit name=NNNN value=aaaaa> 
</form>

<form method= POST action=https://mysite_2.com> 
<input type=hidden name=PPPP value=kkkkk> 
<input type=hidden name=MMMM value=lllll>
<input type=submit name=FFFF value=jjjjj> 
</form>

There can be multiple such form and action within the HTML page. I need to find all input and action values at form level when a submit action is made?

The problem I am facing is to detect which “submit” button of which “form” and its “action” value at form level in the page?

  • 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-10T09:11:07+00:00Added an answer on June 10, 2026 at 9:11 am

    One approach is to use a specified form submission-handling function, which can retrieve the attributes from whichever element is being submitted:

    function submission(form, e){
        e = e || window.event;
        e.preventDefault();
        var formAction = form.action,
            formMethod = form.method;
        console.log(formAction, formMethod);
    }
    
    var forms = document.getElementsByTagName('form');
    
    for (var i=0, len=forms.length; i<len; i++){
        forms[i].onsubmit = function(e){
            submission(this, e);
        };
    }
    

    JS Fiddle demo.

    The above is a slightly-outdated approach, the better alternative uses addEventListener() (or attachEvent (IE), but without IE to test I can only offer addEventListener():

    var forms = document.getElementsByTagName('form');
    
    for (var i=0, len=forms.length; i<len; i++){
        forms[i].addEventListener('submit', function(e){
            submission(this, e);
        });
    }
    

    JS Fiddle demo.

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

Sidebar

Related Questions

php page1 --> below bit is pure html: <form action=page2.php method=post> <input type=text name=name
I have code like so: <form enctype=multipart/form-data method=POST action=blabla.php class=addToCart> <input type=button onclick=addToCartMulti(); value=Add
I've attached onsubmit handler in a form tag like this: <form action=file.php method=post onsubmit=
I have a page that looks like this: Head and body tags... <form runat=server>
I have a form in simple HTML and does not use strut tags. When
I have a HTML form that accepts a comma separated list of tags, which
I have a form where users can enter tags like tag1,tag2,tag3. I explode that
Say I have a simple form like this: <html> <head> <meta http-equiv=Content-Type content=text/html; charset=utf-8
I have a form like below in the view : Here i am not
I have a form for creating an album like following: # app/views/albums/new.html.erb <h2>Details of

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.