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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:31:29+00:00 2026-05-11T23:31:29+00:00

I have a web page that uses cross page posting to post to a

  • 0

I have a web page that uses cross page posting to post to a different target page.

A new requirement has arisen that means that there could be 4 different target pages to post too depending on what data was entered on the client.

Is it possible to somehow change the cross page posting target dynamically on the client?

From looking at the source html I guess it would be possible to use jquery to manipulate the postback target on the submit button, but this seems a bit of a hack.

What are my alternatives, rewrite the pages to remove cross-page posting and do a response redirect passing the data in session?

  • 1 1 Answer
  • 1 View
  • 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-11T23:31:29+00:00Added an answer on May 11, 2026 at 11:31 pm

    Yes you can certainly change the action of the form. I’ll walk you through how to do it.

    First, your form must have a name and an action URL specified in the HTML:

    <form name="aformiam" method="post" action="/somewhere/to/go.php">
    

    Next, you’re going to want to run some JavaScript on form submission, so you should set the onClick property of your submit button to a function, such as the following:

    <input type="submit" value="Send Form" onClick="return submitForm();" />
    

    Finally is your JavaScript function to actually change the form action and submit the form.

    function submitForm() {
      // do anything here you need to determine which URL to post to
      // I am just making an example here
      var targetURL = '/some/url/to/post.php';
    
      // now we will change the form's action
      document.aformiam.action = targetURL;
    
      // finally, submit the form by returning true
      return true;
    }
    

    Note that in the last step where we return true, this submits the form because the input element’s type is submit and the function is triggered by the onClick event. If this were, for example, a button type input element, or an a tag or img then we would need to trigger the form to submit using something like the following:

    document.aformiam.submit();
    

    This solution will work to change the action and submit to a single URL. If you need to post to multiple URLs at once, you will have to make use of other methods such as XMLHttpRequest. If this is the case, post a comment indicating so and I’ll provide an example for that.

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

Sidebar

Related Questions

So, I have web page that uses javascript to let a user select different
I have a web site in asp.net that uses a master page. In this
I have a web page that uses a large image for its background. I
I have a web page that uses three controls to allow a user to
I have a web page that uses jquery ajax to grab the table markup
I have a web page that uses the QuickTime plugin to display a 360-degree
I have to make changes to a legacy web page that uses the IE
I have a web page that includes a bunch of images. Sometimes the image
I have a web page that displays a long line graph inside a div
I have a web page that is being displaying in a winform app using

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.