views:

203

answers:

1

I'm trying to use the form web part to do the following

[TextBox Field for typing a product number] [Submit Button]

On Click of submit should go to:

http://www.link.com/product.asp?=[TextBox Field Value]

+1  A: 

There is actually nothing specific to SharePoint here - this will work the same directly in a html page, using a Form web part or a Content Editor web part (CEWP)

<!-- Catch Enter (KeyCode 13) and submit form -->
<div onkeydown="if (event.keyCode == 13) productSearch()">
   <input type="text" name="productId" id="productId"/>
   <input type="button" value="Go" onclick="productSearch()"/>
</div>

<script>
function productSearch()
{
   var url = "http://www.link.com/product.asp?=" 
             + document.getElementById("productId").value;

   // Open location in current window
   window.location.href = url;  

   // or Open location in new window
   window.open(url);

}
</script>

See window.open documentation for more options when opening a new window

Ryan
Perfect, thanks!
n0chi