SPGetQueryString Issue

Mar 6, 2014 at 5:15 PM
Edited Mar 6, 2014 at 5:16 PM
I'm attempting to setup SPGetQueryString to populate a single line of text field. I'm confident in the jquery and spservices references being correct since I did the alert test as well as being able to run this script to populate a drop down menu field and it worked. I am using SharePoint 2013 in IE and Chrome.
Here is the drop code that worked:
$(document).ready(function() {

        var queryStringVals = $().SPServices.SPGetQueryString();
        var supplierID = queryStringVals["SupplierID"];

            columnName: "SupplierID",

        //like :contains but only selects exact matches
        $.expr[':'].textEquals = function(a, i, m) {
            return $(a).text().match("^" + m[3] + "$");

        var selectedSupplierID = $("option:textEquals('" + supplierID + "')").val();

Here is the code I am attempting:
$(document).ready(function() {

        var queryStringVals = $().SPServices.SPGetQueryString();
        var Simple = queryStringVals["Simple"];
Debug mode doesn't show me any issues.
Thanks in advance for any help.
Mar 7, 2014 at 1:09 PM
I can't tell what the problem is from what you included above. Looks like you pasted the code that works?
Can just post the code that does not work, including the call to set the value on the input field?
1. what version if SPServices?
2. What's the Title of the input field and is it a required field?

Paul T.

-- Sent from Mobile

Mar 7, 2014 at 1:28 PM
Probably a shot in the dark but try referring to the querystring parameter you want as "queryStringVals.Simple." That's how I do it throughout my code and it always works for me. Also, in debug mode, you should be able to set a watch value for both forms and see if either one comes up undefined or null.

Mar 7, 2014 at 4:09 PM
ptavares : The code that doesn't work is the following:
$(document).ready(function() {

        var queryStringVals = $().SPServices.SPGetQueryString();
        var Simple = queryStringVals["Simple"];
I've tried the latest version 2014.01 and the previous version. The title of the field is Simple and it's not required.
Mar 7, 2014 at 4:10 PM
I just tried referencing the value that way and got the same result. I'll see if I can test more in debug mode. Thanks,
Mar 7, 2014 at 4:30 PM
I just want to make sure I'm reading this correctly... The code you pasted does nothing with the values you are trying to capture from the URL... They are variables initiated inside a function and don't see be used to set the value of an input field... I guess I'm confused what exactly is not working. I would have expected to see something like after the code you posted above:
Can you post the value in the URL? from the page name forward should be enough (ex. pagename.aspx?....)

ps. I just tested this utility in SP2013 (O365) with v2014.1 and it worked for me... (meaning: I was able to read values form the URL query with it)
Mar 7, 2014 at 4:56 PM
Ok now I got it. Thanks I guess I was overlooking the obvious.
$(document).ready(function() {
        var queryStringVals = $().SPServices.SPGetQueryString();
        var Simple = queryStringVals["Simple"];
NewForm.aspx?Simple=Testing is the value I'm passing