Making “Post” and “Get” forms from SharePoint’s pages

September 4th, 2008 | Categories: JavaScript, SharePoint, XSLT

If you’ve tried to insert a form into a sharepoint’s page you mus have been disappointed. The form just didn’t work. You can’t make the form to post or get to some url, because the whole SharePoint’s page is one big


So I went a bit deeper on how Microsoft guys are doing it on their spaces site (blog this functionality makes a post to a certain url) and based on this, I’ve made this simple script to make “forms” to post and to submit.

First thing: Insert your form as it should be

      ... etc. with all the fields you need.

Before you save the page or the content editor webparts, make the three changes:

1. Remove the

tags and replace them with

... etc. with all the fields you need.

2. Add the following script before the form

Note: be sure to correct the theForm.action and theForm.method to appropriate url and method (for your form)

3. Change the submit button with

add code similar to the one below for copying the values for each of the input fields

document.getElementsByName('name')[1].value = document.getElementsByName('name')[0].value;

Apply the similar methodology for other types of fields. I’ll try to come up with a universal script to copy values.