I have a page with a regular form:
<form method="post" action="pro.asp">
<input type="text">
<input type="submit">
</form>
when it gets to the pro.asp page it will do some server side actions like sending mail and then I need that page to send all the parameters in the post request to another website
I don't want to have another form filled auto and auto submit with javascript script
Is there a solution for that?
Do you have to make a POST to the other website?
The simplest thing to do may be to, when you are finished your own form processing, send the values to the other page as a GET.
To do that all you would need to do is end your processing with a response.redirect.
Response.Redirect ("http://somewebsite.com?value=X")
Related
I have a Jekyll site and a contact page on which I made a simple form and connected it with service like FormSpree or SimpleForm which automatically sends the responses to my inbox, what I would like to do is redirect to a Thank you for your response page after the form is submitted. Attempted this in many ways like adding event listener to the submit button or using onSubmit or action properties of the form but I was only able to achieve one of the two things, either the form submits or I am redirected to the Thank You Page, unable to perform both when I have no access to the server side script which I could have used for redirection. The form is pretty basic, a few input fields and a submit button. Would appreciate any form of help.
Both services allow a hidden field, in your form, which points to the thank you URL you want to be redirected after submission.
with FormSpree use _next (see advanced features)
<input type="hidden" name="_next" value="https://my-site.tld/thanks.html" />
with SimpleForm use redirect_to (see the sample code in their page)
<input type='hidden' name='redirect_to' value='https://my-site.tld/thanks.html' />
I'm trying to display a form action on same page. Right now it is redirecting to CGI output. How can I display output on the same page without moving away.
Below is the form configured in the page.
<h1>How fast is your connection?</h1>
<hr>
<FORM METHOD=get
ACTION="http://getmeip.net/cgi-bin/1.cgi">
Look for?
<input type=string name=ping>
<P>
<input type=submit value="ping this host">
</form>
</HTML>
Output is redirecting as shown in this picture. .
Either:
Edit the CGI program so it outputs the HTML for the form or
Use JavaScript with XMLHttpRequest or fetch to get the data instead of submitting the form and then update the DOM of the existing page with the response
I have a form with the action like so:
<form id="my_form" method="post" action="http://xxxx/post.do">
The service that receives the form data performs validation and then returns a response. What is the easiest way to do this? I have seen various posts about AJAX that I cannot get to work and I don't necessarily need to submit without refreshing. I just want the simplest solution in pure html/javascript where i can retrieve the server response after submission.
So i am running a JX Browser which allows content to be shown in an iframe. When someone logs into my ticketing software i want to post their username and password to another form in an iframe.
Basically the iframe contains a page in which i want them to be automatically logged in to. The login credentials for the ticketing software and the page are the same all i want to do is pass that credential to an iframe in which there is username and password field.
Like in jquery you can get .val of the what every is submitted and just send it to another form field.. i want to do that..
What is the best practice?
You can set target attribute on a form to point it to an <iframe> by name.
For example:
<form action="process_login_url" method="post" target="iframelogin" id="loginform">
<input name="login" type="hidden" value="login" />
<input name="password" type="hidden" value="p4ssw0rd" />
</form>
<iframe name="iframelogin">
<script>
// automatically post the form
document.getElementById('loginform').submit()
</script>
You need to pre-populate the hidden fields with user login and password, then the form is automatically sent to the iframe. action on your form has to be the other login processing url, not the login form itself (if these are separate). So basically the action attribute of the external form. Names of the input fields also have to match the target form's names.
Example: http://jsfiddle.net/297suggf/2/ - note the iframe has no src attribute, it loads the url from action on the form with the POST data passed with the request. (It's some random website that allows testing POSTs).
I don't think it's a great idea, and it may not work if there's a protection on the receiving end (like a CSRF token), but youu may give it a shot if it's a last resort type situation
I have My request parameters in the URL of current page. When I click on submit in the same page, parameters lost got lost in the new request. How to retain the request parameters even after submitting the form?
You can read the query params from the url and add them as a hidden fields into the form you are submitting. This will send the query string params along with the form.
Send the request parameters as form's GET params
Have the server set the parameters in a cookie so it is available in every page.
Put it in browser's local storage.
If submitting the form via POST, you can include request parameters in the form's action attribute, eg
<form method="post" action="action?id=123&foo=bar">
<input type="text" name="baz">
<input type="submit">
</form>
What you are asking for is state management. It can be done in several ways
HttpSession
Cookies
Hidden fields
URL rewriting.
Hidden fields is an easy way to do it; although the HTML can get more lengthy. I personally prefer HttpSession.