Ok I am working with WolfNet IDX solutions (a housing search provider). They provide script to return search results which is directed to a page on their server. However, the client wants to have the page placed into an iframe within their own site so that the layout stays the same.
My question is this:
After the user clicks on the submit button (form tag below)
<form id="searchForm" name="searchForm" class="SearchForm" action="http://www.mlsfinder.com/ncsc_cmls/mollyazahn/index.cfm" method="post" onSubmit="quickSearch(this); return false;">
The website is redirected to another website with the results, what I need is to have the website that gets returned placed into an iframe on another page within the clients site.
How do I go about doing that, and unfortunately there is not other options besides iframe for the client, it has been demanded
Here is the quickSearch Function
function quickSearch(frm) {
if (document.getElementById('temp_address')){if (frm.temp_address && frm.temp_address.value != "Address") frm.address.value = frm.temp_address.value;}
if (document.getElementById('temp_zip_code')){if (frm.temp_zip_code && frm.temp_zip_code.value != "Zip") frm.zip_code.value = frm.temp_zip_code.value;}
if (document.getElementById('temp_property_id')){if (frm.temp_property_id && frm.temp_property_id.value != "MLS Number") frm.property_id.value = frm.temp_property_id.value;}
frm.submit();
}
If the form was posted, you could just set the target to make it load in the iframe, but the function that is called probably doesn’t post the form.
To make the function load the page in the iframe, you have to change whatever the function does, so that it puts the result in the iframe instead of redirecting the current page.
So, if the function for example does:
you would change it to:
Edit:
The function does actually post the form (despite the code calling the form stopping the normal post), so you can just set a name on your iframe, and use the
targetattribute in the form tag to make it post to the iframe.