Redirect from default form to custom form

Whenever you create a custom form for a list, we always go for creating a Custom List form in SharePoint designer. Of course using this method, you will get the querystring values what you get in the default forms. But what if you want to add more querystring parameters to your custom form page?

One way is to create a webpart and place in the default form, which will redirect to your custom form by adding required querystring parameters. But this is little complex. So I used a JavaScript which you can place in a Content Editor Webpart in the default form.


function getQuerystring(key, default_)
                if (default_==null) default_=””; 
                key = key.replace(/[\[]/,”\\\[“).replace(/[\]]/,\\\]);
                var regex = new RegExp(“[\\?&]”+key+”=([^&#]*)”);
                var qs = regex.exec(window.location.href);
                if(qs == null)
                                return default_;
                                return qs[1];

function doRedirect()
                var ID_value = getQuerystring(‘ID’);
    window.location.replace( ‘/sites/CLegal/LegalOpinions/Shared%20Documents/LegalOpinionForm.aspx?Mode=Edit&ItemID=’ + ID_value  );



Here in the script getQuerystring method gives you the current page’s querystring values and I have added the “Mode” querystring parameter. Never forget to change the parameter name ID to something else in your custom form, since it will give you error in displaying the items


2 thoughts on “Redirect from default form to custom form

Add yours

  1. You actually make it seem so easy with your presentation but I find
    this topic to be actually something which I think I would never understand.
    It seems too complex and very broad for me. I am looking forward for your next post,
    I’ll try to get the hang of it!

  2. I do not even know how I ended up here, but I thought this post was great.
    I do not know who you are but certainly you are going to a famous blogger if you aren’t already 😉 Cheers!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a website or blog at

Up ↑

%d bloggers like this: