Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Auto Populate Form Fields

  Asked By: Jill    Date: Mar 10    Category: Sharepoint    Views: 5672

I am slowly learning about Sharepoint, and some of what it is capable of.

I am trying to do something which I thought would be a standard
requirement of any data based website, but can't work out how to do it.

I have a web part page, consisting of a number of Data Views. I have a
link on each row of one of the dataviews, which links to the form
'NewForm.aspx' of another list. I would like to be able to auto
populate two of the fields in this new form so that the user doesn't
need to enter extra information.

I found this code to take the querystring: I can't get it working, but
maybe I'm totally on the wrong track.

<script language="javascript" for="window" event="onload">
var elems = document.getElementsByTagName("INPUT");
var vSpecID="";
var queryString = document.location.search.split("&");

for (var i=0;i<queryString.length;i++) {
if (queryString[i].split("=")[0]=="?SpecID")
vSpecID=queryString[i].split("=")[1];
}

for (var i=0;i<elems.length;i++) {
if (elems[i].name=="OWS:SpecID:Local") elems[i].value=vSpecID;
}
</script>

As you can see the field I am trying to populate is called 'SpecID'. I
don't know if this is how to reference the INPUT box, but it's all I
can find.

The other thing I will want to do, is once the user is finished with
NewForm, the should be returned to the original WebPartPage.

I really appreciate any insights you can give.

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Auto Populate Form Fields Or get search suggestion and latest updates.




Tagged: