views:

335

answers:

2

It's easy to create a hyperlink that passes parameters using GET by adding them to the URL:

http:\somesite.com?name=fred

but the web service I'm connecting to uses POST. What's the best way to do this in Sharepoint?

A: 

OK, I'm not surprised there's no answer to this. I suspect I'm probably approaching this in the wrong way and not explaining it well.

I want to take the user's browser to a diffent page passing POST data, like a HTML form would. But in sharepoint you can't change the 'action=' - you can only post back to the same page - if I understand the page life cycle bit correctly.

I'll try adding a button to the web part and use it's onclick() to do a HTTP web request.

onyougoson
A: 

If you need to post data differently, adding a second form element to the page should work. It needs to be outside the SharePoint form, but adding another element outside that is easy enough with javascript/jQuery.

Tom Clarkson
Thanks for that, but all the docs I've found say only 1 active form can be rendered.Managed in the end by adding a button witha different post back url and a few hidden vars:this.wpmButton.PostBackUrl = "aserver.com";this.Page.Form.Method = "POST";this.Page.RegisterHiddenField("Item", "Value");
onyougoson
The single form restriction is in ASP.NET (and even then there are a number of exceptions). The version I suggested is pure html, so ASP.NET restrictions don't apply.
Tom Clarkson