I am using an html form to submit information to a specific URL that is loaded in an iframe on one of my website pages on my domain. One of the html form inputs is a URL that will be posted in the iframed page when I submit the form. But when I click on the link (the one which I have specified the URL for in the html form), I need it to break out of the iframe, and load in the parent window (the window which the iframe is currently in).
This is my form, and you can see the input for the "producturl"...that is where I am having trouble...
<form action="http://ww#.aitsafe.com/cf/add.cfm" method="post">
<input type="hidden" name="userid" value="#######">
<input type="hidden" name="nocart">
<input type="hidden" name="return" value="www.fruitfulfarm.net/cart_2.html">
<input type="hidden" name="producturl" value=<a href="www.fruitfulfarm.net" target="_top"</a>
<input type="hidden" name="product" value="Product">
<input type="hidden" name="price" value="49.95">
<input class="rounded" type="submit" name="Submit" value="Add To Cart">
</form>
Can someone show me a way to get the URL to break out of the iframe by using a certain target/value code in the "producturl" syntax?
I would use some JavasScript.
this.top.location = "www.fruitfulfarm.net";
Have a look at css-tricks.
Related
So, I have a custom newtab page where I show some options for reverse image searching when I drag something over the page.
Here is my not working code for TinEye:
<form
action="https://tineye.com/search"
method="POST"
enctype="multipart/form-data"
target="_blank"
>
TinEye
<input type="file" name="url" />
<input type="submit" />
</form>
And here is my working code for google:
<form
action="https://images.google.de/searchbyimage/upload"
method="POST"
enctype="multipart/form-data"
target="_blank"
>
Google Images
<input type="file" name="encoded_image" />
<input type="submit" />
</form>
I looked in the code from TinEye (They have public sourcemaps, pretty cool!) and think the search/upload logic works completely through JavaScript and does not work with a form submit like mine, but if someone of you has a solution that works somehow, without me needing to upload the image first to a server, please tell me.
Thanks in advance
I found the solution by myself and it looks like this:
<form
action="https://tineye.com/search/upload"
method="POST"
enctype="multipart/form-data"
target="_blank"
>
TinEye
<input type="file" name="image" />
<input type="submit" hidden />
</form>
I just tried a bit of random stuff, added the "upload" to the url like it needs to be for google and did take the parameter name ("image") from the input at the TinEye start page.
Trying to make Google Image Search Clone using HTML form where after entering text in the search field it will take you directly to Google Image search results page.
Here is the code that I am using:
<body>
<form action="https://google.com/search">
<input type="text" name="q">
<input type="submit" value="Google Search">
</form>
</body>
It will take to normal google search, how do I change it to google image search result page?
You have to change the action, as such:
<form method="get" action="http://images.google.com/images">
<input type="text" name="q" />
<input type="submit" value="Google Search" />
</form>
Google image search link is of the following format
https://www.google.com/search?q=```query```&tbm=isch
Each of the parameters, q and tbm, requires an input tag but tbm does not require any user input.
'GET_parameter_name=value' for every input tag before submit button is appended by '&'.
<form action="https://www.google.com/search">
<input type="text" name="q" id="box">
<input type="hidden" name="tbm" value="isch">
<input type="submit" value="Image Search" >
</form>
Source:
https://stenevang.wordpress.com/2013/02/22/google-advanced-power-search-url-request-parameters/
https://www.xul.fr/javascript/parameters.php
As the title states, I'm trying to incorporate many searches into one search bar. More specifically, Google and Amazon. I have setup a radio option to set which site to search when one is selected.
This is the code I currently have:
<form method="get" action="http://www.google.com/search">
<div align="center" style="font-size:75%">
<input type="text" name="q" size="25" maxlength="255" value="" />
<input type="submit" value="Google or Amazon Search" /></br>
<input type="radio" name="sitesearch" value="" />The Web
<input type="radio" name="sitesearch" value="yoursite.com" checked />This Site
</div>
</form>
I have this form for Amazon, but I'm just unsure how to code it into the one search bar.
<form action="http://amazon.com/s/ref=nb_sb_noss" method="get" target="_blank">
<input type="text" id="twotabsearchtextbox" name="field-keywords">
<input type="submit" value="Search" class="nav-submit-input">
</form>
Use JavaScript to change the actual form action in page's DOM (and other parameters, if needed), depending on the user selection (use onclick event on radio to montior for change for example). Simple as that. You won't be able to do that in pure HTML without using some kind of proxy server to redirect the requests and return the results appropriately.
document.your-form.action = (google_selected) ? "http://www.google.com/search" : "http://amazon.com/s/ref=nb_sb_noss";
etc.
Using <form method="get"> element including <input type="submit"> element, we can have a way to GET a web page with some fields specified by the <input type="text" name="studentId"> elements, but can I customize those fields?
For example: I always want to add a action=true to the GET url to let the URL be something like this: http://example.com/?studentId=123&action=true?
Use <input type="hidden" name="action" value="true" />
inside your form.
You can add a hidden form field, though the name action is not a good one, as form has an action attribute and this name can conflict when scripting the form:
<input type="hidden" id="something" name="something" value="somthingelse" />
<div id="gbqffd">
<input type="hidden" value="en" name="h1">
<input type="hidden" value="d" name="tbo">
<input type="hidden" value="search" name="output">
<input type="hidden" value="psy-ab" name="sclient">
</div>
Google always has the answer; in this case I never had to do a search just look at the source :)
While using IE9, every link (when clicked) the search form is being submitted. Every link seems as if it is redirecting to the action value of the search form.
There is no java script attached to the form element.
<form action="/my-search-url" method="post">
<input type="submit" value="search" />
<input type="text" value="" />
</form>
The issue was with the order of the form elements. Apparently the original developer decided to place the submit button before any input elements. By putting the submit input last (or removing it) fixed this issue.
<form action="/my-search-url" method="post">
<input type="text" value="" />
<input type="submit" value="search" />
</form>