admin管理员组

文章数量:1391964

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:

.asp?=[TextBox Field Value]

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./product.asp?=[TextBox Field Value]

Share Improve this question asked May 4, 2010 at 17:22 Aditya TAditya T 1473 gold badges4 silver badges14 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 2

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./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

本文标签: Sharepoint Form Webpart with JavascriptStack Overflow