I have a listview setup on my page which shows orders from an orderlist. Works great. Now I want to add a column which displays an icon. When the user clicks this icon, the NewForm.aspx page from another list should popup. This other list also contains an ordernumber column, so I would like this column to be prefilled by the ordernumber of the line on which the user clicked the item.

I already know how to pass along the ordernumber to my javascript method, and I know how to get the NewForm.aspx page to popup in a modal popup using the modal framework. But now for the last challenge: how am I going to transfer the ordernumber from my javascript method into the correct textbox on the NewForm.aspx page? As far as I know there's no ootb way of passing in default values via querystring or something like that, right?

So I see two possible options:

  1. A query string parameter and some code on the NewForm.aspx to get this value and set the textbox.
  2. Getting the displayed page in my javascript method after the popup is displayed and setting the value throug there.

I have no clue on what the best / correct approach would be, or maybe I'm missing a better option? So I'd like your point of view on this.

  • I have a close issue with your problem, I want to fill my newform.aspx with the current url where the user call the form. Did you find a solution?
    – user5379
    Commented Oct 25, 2011 at 9:43

4 Answers 4


I think you're on the right track; either of your two options would work. In the past, I've used a JavaScript function to open a modal window with the form, and pass a query string to the form. You can then use some simple JavaScript to detect the query string and populate the form; I tend to prefer that approach since it doesn't require customizing the form in SharePoint Designer.


I had the same task. I found that NewForm.aspx handles automatically query strings which surprised me. The query strings must use internal names. And there is no need for custom code. So to pre-fill Title in the NewForm.aspx (even if you see "Titel" or "Tittel" or something else), just add ?Title=Hurray, like

  • Excellent answer.. @Anatoly Is it possible to make the column disabled if we are passing the value? Commented Mar 16, 2015 at 13:35
  • @Anatoly, is it possible to pre-fill a lookup property this way by passing the lookup id? Also, is it possible to pre-fill a lookup property to a list exceeding the 5000 threshold?
    – Gintas K
    Commented Dec 6, 2016 at 15:34

I know this is an old answer, but I thought I'd chip in:

Most people use the query string approach. The SPServices plug in is really useful here (http://spservices.codeplex.com/), or you can write your own javascript within the form to get querystring parameters. I normally bundle this in to my own method:

function getQueryParameters() {
    var qObj = {};
    var urlSearch = window.location.search;
    if (urlSearch.length > 0) {
        var qPart = urlSearch.substring(1).split('&');
        $.each(qPart, function(i, item) {
            var splitAgain = item.split('=');
            qObj[splitAgain[0].toLowerCase()] = splitAgain[1];
    return qObj;

You can then access the values:

var qString = getQueryParameters();
var myValue = qString["myValue"];

I would like to point out that Anatoly Mironov's answer is not correct: The only field that you can pass without additional code in the query string is the 'Title' field. I have tried all kinds of permutations with other fields, using the internal column name and the display name to no avail.

  • Great advice here! I've used SPServices and jQuery to pop up a custom modal form that has only the necessary fields for my use case scenario (and not the ribbon and other sharepoint boilerplate styling). Then, you create the record with SPServices and gracefully close the form. It is a bit of extra work, but the UX experience increase can be dramatic.
    – tyshock
    Commented Jan 17, 2014 at 15:57

I would recommend the querystring approach, it is a standard and clean way to pass data.


  • you can point to your newform from various locations
  • it'll work in both modal mode and standalone
  • it'll work across sites and domains

Another option would be to use cookies. I sometimes use them in longer processes.

  • Cookies is a bit overdone. Do you perhaps have a good example of how to do this using querystring? I'd also need a way to deploy that adapted NewForm.aspx file with my solution.
    – Jasper
    Commented Oct 20, 2011 at 9:12

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.