Case insensitive SPGetQueryString?

Nov 4, 2013 at 4:05 PM
Edited Nov 4, 2013 at 4:05 PM
Can I put a plug in for modifying SPGetQueryString so that it can be used without case sensitivity? I hate the idea of case sensitive query vars if they can be avoided. I found this code out there that has a number of nice options, but I'd so prefer to have it all just rolled into spservices? :)
Nov 4, 2013 at 4:53 PM

The problem is that case can make a difference. What I return with the function is an object containing name/value pairs
var queryStringVals = $().SPServices.SPGetQueryString();
If the URL is default.aspx?MyParam=abc

then the queryStringVals contains this object:
{myParam: "abc"}
Case is significant in JavaScript objects.

Nov 4, 2013 at 6:05 PM
I get that it's doing that. I'd just like to be able to say, "hey - for me, if I call queryStringVals('myParam') - give it back to me no matter the case. So, in the example code I sent, I'd call
var effortID = $.QueryString( "effortid", { 
        // options  
        isCaseSensitive : false
And, it wouldn't matter if the URL param was effortid, EffortID, or effortID, I'd still get my value back. (It defaults to being case sensitive, but doesn't have to be.)
Nov 4, 2013 at 6:14 PM
Yeah, but I'm passing you back an object, not a function. I could covert all the parameter names to lower case [or upper case] as an option, but you'd need to request it and know that you've requested it. Doesn't that sort of defeat the purpose?

Nov 4, 2013 at 6:26 PM
Actually, having the option to pass back all the parameter names as lower or upper case would be helpful to me, because I can control what member of the object I call. So, if I know that calling queryStringVals.effortid will get me the value even if the URL param was EffortID, I'm totally happy making sure I call queryStringVals.effortid.

Essentially, I can control my code, but I can't control what people do with their URLs.
Nov 4, 2013 at 6:53 PM
So what if I add an option called lowercase which is false by default. If you set it to true, you'll get all the parameter names back in lowercase.

Nov 4, 2013 at 7:05 PM
I'd be a happy coder girl. :)
Nov 4, 2013 at 7:32 PM
You'd probably be the only person who ever uses it, but for you...

Because case matters in JavaScript, it feels a little wrong.

Nov 4, 2013 at 7:32 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.