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 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.