Forum Moderators: open

Message Too Old, No Replies

Open a form's search results in a new window?

Customizing a 3rd party site's search box

         

prfb

11:04 pm on Feb 4, 2008 (gmt 0)

10+ Year Member



I have a search box I got from a 3rd party that links to results on the 3rd party's site. I really like the box, but unfortunately it puts the results in the current window. My site has widget information users like to use in parallel with the 3rd party's search results.

How do I make the results appear in a new window?

I'm not good with HTML so hopefully I didn't cut out anything important when I tried to make the code anonymous and simpler. Please let me know if you need more details.

Any help much appreciated.

Thanks,
P


<div class="clear"></div>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<div class="mystyle" style="font-family: arial, verdana; margin:auto; font-weight: bold; font-size: 12px; border: 1px solid black; width: 125px; padding: 20px; padding-top: 50px; background:url(http://theirsite.com/images/ads/cd_bg.gif) top left no-repeat;">
<form action="http://www.othersite.com/interactive" onsubmit="return validateSearchForm(this)" name="sidesearch" method="get">
<div class="bold" style="padding-top:4px; ">Color:</div>
<select name="WidgetColor" id="WidgetColor" class="form" style="width:120px;">
<option value="" selected>Any color</option>
<option value="1">Blue</option>
<option value="2">Green</option>
</select>
<div class="bold" style="padding-top:4px; ">Origin:</div>
<div>
<select name="OriginID[]" id="OriginID[]" size="5" multiple class="form" style="width:130px;" onchange="showOriginDetailsMulti(this)">
<option value="" selected>Any origin</option>
<option value="1">Origin 1</option>
<option value="2">Origin 2</option>
</select>
</div>
<br>
<br>
<input name="Thing" type="image" value="Go" src="http://www.theirsite.com/images/searchbutton.gif" alt="Search" width="90" height="25" border="0">

<input type="hidden" name="aid" value="12345"/>
<input type="hidden" name="pid" value="67890"/>
<input type="hidden" name="url" value="http://res.theirsite.com/widgets/search.rvlx"/>
</form>
</div>
</body>
</html>
<img src="http://www.othersite.com/image-12345" width="1" height="1" border="0"/>
<div class="clear"></div>
<br />

tedster

11:36 pm on Feb 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



From what I can see the generation of the search results url is handled by the action attribute of the form. In other words, a script on the other site's server creates the results page rather than a link. This doesn't give you an opening to change how it works directly, using a target= attribute or a javascript window.open.

Can you make the search widget itself available from a new dedicated page on your domain, rather than integrating the widget code directly into each of your existing pages?

That way, someone clicks on a link for the search widget and a new page opens on your domain that contains the inputs for the widget. Then when they submit the form the result will appear in the new window you just opened - but the user still has one window available from your domain.

prfb

11:50 pm on Feb 4, 2008 (gmt 0)

10+ Year Member



Tedster- Thanks, that makes sense.

Unfortunately, what I love about this box is that it fits really nicely on content pages -- so users can seamlessly go from reading about the delights of blue, mid-size widgets to checking their price.

Drat.

prfb

10:50 pm on Feb 21, 2008 (gmt 0)

10+ Year Member



Eureka!

Figured out a way, and figured I'd share in case anybody else is in this bind. Just need to insert target="_blank" within the open form tag!

So rather than...

<form action="http://www.othersite.com/interactive" onsubmit="return validateSearchForm(this)" name="sidesearch" method="get">

It's now...
<form target="_blank" action="http://www.othersite.com/interactive" onsubmit="return validateSearchForm(this)" name="sidesearch" method="get">

Works in both FF and IE.