Not using iFrames very often so I could really do with your help here...
I have a form on a webpage which opens an external online booking engine with availability depending on the dates selected in the form.
I'd like to open the external booking page in an iframe named "mainframe" on a new page, book.html.
The start and end code for the form is:
Code:
<form name="roseform" method="post" action="http://www.hotelexec.co.uk/external.asp"></form>
<input type="text" class="dimmed" placeholder="Brasil" id="keywords" name="keywords" />
Search
How would I set the target to "mainframe" at the book.html page so the results from the form would be displayed there? I understand I need to make Iframe source to be a dynamic URL.
Thanks,
Blazer
Just add target attribute.
<form name="roseform" target="mainframe" method="post" action="http://www.hotelexec.co.uk/external.asp"></form>
UPDATE
As I understood you need this steps:
For start change .html to .php
Change action of form in itmjobs.ro/lidl/page1.php to point page2.html
<form name="roseform" method="post" action="http://itmjobs.ro/lidl/page2.php"></form>
In page2.php add iframe with address http://itmjobs.ro/search-results-jobs/
<iframe src="http://itmjobs.ro/search-results-jobs/?<?php echo http_build_query($_POST)?>"></iframe>
Now you will see data from http://itmjobs.ro/search-results-jobs/ in your iframe.
Related
I am working on a new project and decided to do a lot of the coding myself, I am by no means a web developer but here we are :)
So....
I am coming towards the end of coding and just linking a few things up, I have WHMCS running on a vhost based external link and I need my domain search form to direct people from my main website to the vhost external link.
Here is the code I have so far...
<form method="post" action="https://bill.spacesrv.com/cart.php?a=add&domain=register&" target="_blank" class="uk-form idz-search-domain-form">
<fieldset>
<input type="text" class="uk-form-large uk-width-1-1" name="query" value="" placeholder="find your perfect domain name">
<button type="submit" class="uk-button-large idz-button blue uppercase">Find Domain</button>
</fieldset>
</form>
I have the domain in the action tag, I need that to stay the same and what the customer will search in the search box needs to go on the end of the domain.
This is what the final link should look like...
https://bill.spacesrv.com/cart.php?a=add&domain=register&query=domain.com
But currently when I hit the search button it is going to this link...
https://bill.spacesrv.com/cart.php?a=add&domain=register&
It is not adding the query={searched domain} to the end of the link.
It is a WHMCS link which is open for the world to see anyway, its not a link that needs to be hidden.
Nothwithstanding the fact that you need to take care of security ( dont open the target page for forms coming from anywhere ), you just need to specify the GET method for the form :
<form method="get" action="https://my.page.com?a=add" target="_blank" class="uk-form idz-search-domain-form">
I've a little problem. I submit a form to my route/uploadpdf with
<form action="http://localhost:3000/user/uploadpdf" enctype="multipart/form-data" method="post" onSubmit=window.location.replace('http://localhost:3000/statictoken')>
<input type="file" name="upload" multiple>
<input type="submit" value="Upload">
</form>
and when it is complete the browser tries to traverse to uploadpdf.
What I actually want is to stay on the current page ("statictoken") and refresh. You can see I've attempted to replace onSubmit, but it doesn't work.
The form action attribute is used to send the request to the specified page. If you want to send the request to the current page itself, you should have the following :
<form action="/" ...>
But keep in mind that now, you have to tackle the functionality of uploadpdf page on your 'statictoken' page.
You can also redirect to the "statictoken" page from the "uploadpdf" page after the file upload completes.
Or better, you can use Ajax File Upload, so that form is submitted asynchronously without redirecting you to the "uploadpdf" page.
I have a form in my webpage,
The form uploads a file to my server.
currently when the file upload form submits, after the server side finishes saving the image it tries to redirect my webpage to a different page :( (the name of the form action)
is there a way to execute the form without the redirect part? like an ajax call for uploading my image?
thanks.
here is the form:
<form method="POST" action="/project/upload"
enctype="multipart/form-data">
Please select a file to upload : <input type="file" name="file" />
<input type="submit" value="upload" />
</form>
EDIT - Let me try to rephrase it:
is it possible to submita form in such a way that it wont change my page or redirect?
and is it possible to create a call back when it finishes?
You can use target="iframeName" on your form to get it to post to an iframe on the page with no reloads occuring. Something a little like this:
<form method="POST" action="/project/upload"
enctype="multipart/form-data" target="myFrame">
..Form content..
</form>
<iframe name="myFrame" height=0 width=0></iframe>
Think best way is using a php page which calls itself with no redirect:
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
....
</form>
So you call the same page to do upload and don't need redirect. In other way you can add header in php page "/project/upload" with automatic redirect to put after upload code:
header("location: yourpage.html");
I am using POST in an HTML form to POST large number of arguments.
I wrote something like this:
<form action="get_status_aisleid.html" method="POST">
<input type="hidden" name="aisleId" value=<% $aisle_id %> />
<input type="hidden" name="enter code heretype" value="verified" />
<input type="hidden" name="value" value=<% $values[1]%> />
<a href="#" onclick="this.parentNode.submit()">
<% $verifiedbaySize %>
</a>
</form>
Everything works fine, if I click on a link in the same window.
But if I right click and open it in a new tab, then my new file (which is doing some operations on arguments passed and then downloading a file) is not called. Instead, the same page is refreshed.
Can someone please suggest something?
Right clicking an opening in a new window will always follow the link (i.e. href="#" meaning "Go to the top of the page". The JavaScript won't run.
No built in control of the browser will submit a form while giving the user the option to choose if it should be in the same or a new window.
This isn't normally a useful choice anyway - opening in a new window is something usually done when the user intends to return to the current page to pick up where they left off, and a form is not something normally presented in the middle of another task.
The closet you could come would be to add a second JavaScript triggered control that sets the target attribute of the form to _blank before triggering submission.
I have one html page, with a form on it. When the user posts the form, I want the form receiving the response to automatically open up the URL passed by the post in a new browser window.
Basically the URL is passed to the the other page, which in turn opens the URL in a new window then displays another form.
Thanks in advance.
Cheers
Shane
Add target="_blank" attribute to the <form>.
<form action="http://google.com/search" target="_blank">
<input type="text" name="q" />
<input type="submit" />
</form>
This will show the response in a new (blank) window. Note that this happens before the HTML page is loaded (it wouldn't make much sense otherwise).