Page A is the parent. From page A, the user clicks on a link and a new page B opens. I do not own page B. Then there, there is some kind of registration form for the user to complete. I need to know in page A that the form on B is submitted correctly when it happens (inject JS?).
I will handle the JS to determine if the form is completed or not. What I'm asking if it is possible what I am looking for, to send back the info to page. I would do this using an iframe, all within the same page but I am getting mixed content errors as page B is in http (I need my page A to be in https).
Normally this is not possible, but sometimes forms have some kind of callback, for instance forms from payment providers. They allow you to send your customer to their payment page, and they redirect them back to a callback page after the payment is done. Hopefully PageB supports such a thing, otherwise, you're in trouble.
One possible solution, if the form isn't very complex, and doesn't have much scripting, and doesn't require logon or other session or cookie related stuff, you might use file_get_contents or curl to get the form, modify it a little to post the changes to another script of yours, and then, from the server, post the form data to originating server. That way, you capture the entire form and everything the user submits is submitted through your server, giving you all the information you need.
Of course this is not easily possible with every form, so you'll have to try if it works for this one.
Related
I have a react app. I need to send a user to fill a form(s) on an external page (in another domain), and then get back with the result (success/fail) of the form submitted there, to continue the process in my react app.
I don't control the other domain or the app there (it is a 3rd party), but I can ask them to make changes (and maybe they will agree, if it is not too complex).
The external forms are not html only, trey have javascript in them as well (for example to autocomplete cities names, etc).
How can that be achieved?
I thought about few options:
Iframe + postMessage
Popup + postMessage
Redirecting, and asking them to change site so they will redirect back to me on form completed.
Asking them to make a special form just for me that I can embed inside my design.
Issue with 1,2,3 is that it will show the entire external page, which has not just the form, but also other links, so user can get "lost" and never come back.
Is there a simpler way to do that? The less I need to rely on them to make changes the better, and if I can avoid iframe/popup/redirecting and show the form inside my app is better
I want to set up a page within my site that contains a form for a prospective client to fill.
I would then manually inspect the form's results to ensure the prospect is qualified, and then send them a temporary link to another page that expires in a few hours, or perhaps after one click.
Any advice that can help me towards this goal would result in me thinking you were very cool.
Thanks!!
ms
This would be done server side. The general flow would be that you would submit the html form to the server. Place the data from the form into a server side database. Send an email to the site admin, notifying them that an entry has been made. Then build a control panel where they can view entries and approve them. This would then send an email to the form submitter, grant them access etc.
It may be an easier better approach to use a form service that does most of this for you.
Take a look at:
https://www.formstack.com
If you want to code it your self. You could use a framework such as:
https://firebase.google.com/ (Js)
or
https://github.com/expressjs/express (Node js)
I have a poll system provided by an outsourced application.
After users choose one of the radio button's choices and click a Submit button, my JavaScripts will redirect them to a specific url (ex. http://www.poll.com/answer). This is a must for posting data to that outsourced application, so this url must be processed.
But what if I don't want to show users this page, but redirect them to a finish page, What should I do with this condition in JavaScripts?
It looks like this.
..When click Submit..
Hidden Run URL for posting data to an outsourced application. (MUST DO)
Redirect to MY finish page.
One possible solution, depending on if you are doing server side programming, is to submit the data in the code behind.
After submitting the data to your code that handles the form submission. Your code passes the values to the third party instead of having the third party be the form submission location. Since you are handling the form submission with your code, you are free to redirect the user as you please.
If you aren't doing server side programming, I'm not sure if there is a way to hide the form submission location from the user.
I'm going to make a few assumptions to clarify my understanding.
You have a web page which contains radio buttons
When a user selects a radio button and submits, you want to post this answer to an external url
Once the data is posted to the external link, you want to show a success page to the user.
You have two options:
Server Side
When a user submits a radio button selection, post the data to a url on your own server. Like a simple form submit
On the server, take the user's input and post it to the target URL.
Return a success page to the user
As far as the user is concerned, he never leaves your site.
Client Side - Ajax
When a user submits a radio selection, trap the submit event, make an ajax call to the target url, posting the user's selection
When the ajax call returns success, ie the data has been posted properly, redirect the user to a success page url, hosted on your own server
Let me know if you need further clarification.
A site I am working on requires user information to be collected from a form when the user presses the submit button. The site will then take the information and plug it into a more robust form on a different page, so the user does not have to retype the information twice.
Is this possible using javascript?
Any help appreciated.
Once the user leaves the current page, the JavaScript on the original page is no longer running, They will load up the other page and run that page's JavaScript.
Do you have ownership of both pages?
If so, then you can leverage the form GET to pass information across pages, so the next page will have a Query string, and JavaScript can parse that.
Another way to move data from one page to another is to use Cookies. So it really depends on how much data you want to move around.
But I highly recommend that you leverage the server-side technology to handle the form GET or POST and carry information across pages.
This completely depends on the OTHER site. You can have a form with the same field names and post it to the same URL the other site's form uses.
BUT - if that site checks to see where the original post came from, it may block you out.
I went to test my page on another browser. On google chrome i can fill out a form, hit back and forward and still have the data there. Now i need to refresh the page so certain data is correct (such as session id if the cookie expires or user logs out before submitting). I refresh and lose all data. Is there some option i can set so all data is kept?
What framework are you using? For example, ASP.Net WebForms would handle this via ViewState (yuck), ASP.Net MVC would require you to do this manually etc.
You essentially need to persist your data somewhere while the page reloads, and then re-populate the controls.
You would have to send the values to the server while they are typed in, and then repopulate the form fields on refresh.
Yes, the only secure way to do this is to use a serverside script to store the form temporarly. Since browsers handles back/forward diffrently your page won't be x-browser compatible if you don't use the server. If the user hits the back button you are kind of lost already since no post is done, unless you post the form with some javascript magic before the new page is refreshed.