Multiple urls in one form action? No problem!

by  • September 8, 2011 • Uncategorized

I was trying to update a bing module today at work with some new click and tracking codes. The new click urls required me to daisy chain two urls together for the form action AND pass some other params over, including the search term. I tried pass one url in the query string to the other with no avail, then our VP of Engineering (you may no him as Cha0ticZ) sends me this little gem (with one modification to launch in a new window). No rocket science here, just good old fashion javascript.

<form method=”GET” name=”bing-form-submit” id=”bing-form-submit” onsubmit=”var newLocation=’http://ad.doubleclick.net/clk;xxxxxxxxxx;xxxxxxxxx;c?http://www.bing.com/search?q=’ + document.getElementById(‘q’).value; window.open(newLocation,’bing_results’,scrollbars=1,resizable=1); return false;” action=””>…</form>

So rather than submitting the form, we’re really just launching a new window with the url we want (like all the other links in the unit). Rok.

Leave a Reply

Your email address will not be published. Required fields are marked *