PreFill Form Field
Posted by bburke - May 26 ’13 at 09:45
I have two lists, "Pipeline" and "Notes". I am following the blog post http://formsdesigner.blogspot.com/2013/04/sharepoint-2013-form-with-related-items_11.html
I want to prefill the "Pipeline" field in the New Item Notes form with the "Title" field from the "Pipeline" form.
In the Parent (Pipeline) Edit form I enter the following in the js-editor:
// getting query string hash var queryString = SP.ScriptHelpers.getDocumentQueryPairs(); // adding get-parameter 'order' into new item link newItem.attr('onclick', 'NewItem2(event, "' + newItem.attr('href') + '&Title=' + queryString['ID'] + '"); return false;')
In the (Notes) New Item Form, I enter the following in the js-editor:
// getting query string hash var queryString = SP.ScriptHelpers.getDocumentQueryPairs(); // fill order number fd.field('Pipeline').control().value(queryString['Title']);
I see the Title ID in the url when I open the Notes NewItem Form.
But the Title ID in the url is populating the "Title" field in the Notes New Item Form.
Am I doing something wrong?
-
DmitryAdminMember for: 11 years 3 months 13 days
First, you have to rename your get-parameter. SharePoint prefills Title field with parameter named ‘Title’.
How many items are in Pipeline list?
This script works only if items count in the dropdown is less than 20: fd.field('Pipeline').control().value(queryString['Title']);
Use this one, that works for any count of related items:
var queryString = SP.ScriptHelpers.getDocumentQueryPairs(); var id = queryString['Title']; if (fd.field('Parent').control()._el().find('input').length > 0) { var control = fd.field('Parent').control()._el().find('input'); var options = control.attr('choices').split('|'); $.each(options, function(i) { if (i % 2 == 1 && parseInt(this) == id) { $('#' + control.attr('optHid')).val(id); control.val(options[i-1]); return false; } }) } else { fd.field('Parent').control().value(id); }
My lookup field called ‘Parent’, so, you have to rename it to ‘Pipeline’.
-
bburkeMemberMember for: 10 years 4 months 2 days
Thanks for your great support helping me solve my issue.
-
bburkeMemberMember for: 10 years 4 months 2 days
This works in Internet Explorer but is not working in Firefox 21.0. Can you assist?
-
DmitryAdminMember for: 11 years 3 months 13 days
[#3]: I have just checked this code in the latest version of FF and it seems it works correctly. Please, verify that you have correct internalName in the highlighted line:
if (fd.field('Parent').control()._el().find('input').length > 0) { var control = fd.field('Parent').control()._el().find('input'); var options = control.attr('choices').split('|'); $.each(options, function(i) { if (i % 2 == 1 && parseInt(this) == id) { $('#' + control.attr('optHid')).val(id); control.val(options[i-1]); return false; } }) } else { fd.field('Parent').control().value(id); }
-
KatlerMemberMember for: 2 months 21 days
Rusiya millisinin oyunları üçün 3-cü kateqoriyalı biletlərin qiyməti 43-74 avro arasında dəyişir. İkinci kateqoriyanın qiyməti 64-104 avro, birinci kateqoriyanın, ən bahalısı isə 114-174 avro arasındadır. Uşaq biletlərinin qiyməti: 24-34 avro mostbet yukle
-
Riyanasharma01MemberMember for: 1 month 19 days
Get a stunning girl from Udaipur Escort Service, and she will provide you with all the services you require; all you have to do is arrange a meeting with her.
Puri Escort Service || <> || Rayagada Escort Service || <> || Sambalpur Escort Service || <> || Sonepur Escort Service || <> || Sundargarh Escort Service || <> || Amritsar Escort Service || <> || Barnala Escort Service || <> || Bathinda Escort Service || <> || Fazilka Escort Service || <> || Faridkot Escort Service || <> || Fatehgarh Sahib Escort Service || <> || Firozpur Escort Service || <> || Gurdaspur Escort Service || <> || Hoshiarpur Escort Service || <> || Jalandhar Escort Service || <> || Kapurthala Escort Service || <> || Ludhiana Escort Service || <> || Mansa Escort Service || <> || Moga Escort Service || <> || Mohali Escort Service || <> || Muktsar Escort Service || <> || Pathankot Escort Service || <> || Patiala Escort Service || <> || Rupnagar Escort Service || <> || Sangrur Escort Service || <> || Shahid Bhagat Singh Nagar Escort Service || <> || TarnTaran Escort Service || <> || Gangtok Escort Service || <> || Mangan Escort Service || <> || Namchi Escort Service || <> || Geyzing Escort Service || <> || Ariyalur Escort Service || <> || Chengalpattu Escort Service || <> || Chennai Escort Service || <> || Coimbatore Escort Service || <> || Cuddalore Escort Service || <> || Dharmapuri Escort Service || <> || Dindigul Escort Service || <> || Erode Escort Service || <> || Kallakurichi Escort Service || <> || Kanchipuram Escort Service || <> || Kanniyakumari Escort Service || <> || Karur Escort Service || <> || Krishnagiri Escort Service || <> || Madurai Escort Service || <> || Nagapattinam Escort Service || <> || Namakkal Escort Service || <> || Nilgiris Escort Service || <> || Perambalur Escort Service || <> || Pudukkottai Escort Service || <> || Ramanathapuram Escort Service || <> || Ranipet Escort Service || <> || Salem Escort Service || <> || Sivaganga Escort Service || <> || Tenkasi Escort Service || <> || Thanjavur Escort Service || <> || Theni Escort Service || <> || Thoothukudi Escort Service || <> || Tiruchirappalli Escort Service || <> || Tirunelveli Escort Service || <> || Tirupattur Escort Service || <> || Tiruppur Escort Service || <> || Tiruvallur Escort Service || <> || Tiruvannamalai Escort Service || <> || Tiruvarur Escort Service || <> || Vellore Escort Service || <> || Viluppuram Escort Service || <> || Virudhunagar Escort Service || <> || Lakshadweep Escort Service || <> || Amini Escort Service || <> || Andrott Escort Service || <> || Kadmat Escort Service || <> || Kalpeni Escort Service || <> || Kavaratti Escort Service || <> || Minicoy Escort Service || <> || Karaikal Escort Service || <> || Mahe Escort Service || <> || Puducherry Escort Service || <> || Yanam Escort Service || <> || Goa Escort Service || <> || Panaji Escort Service || <> || Margao Escort Service || <> || Daman Escort Service || <> || Diu Escort Service || <> || Dadra haveli Escort Service || <> || Andamand & Nicobar Escort Service || <> || Portblair Escort Service || <> || Agra Escort Service || <> || Aligarh Escort Service || <> || Allahabad Escort Service || <> || Ambedkar Nagar Escort Service || <> || Amethi Escort Service || <> || Amroha Escort Service || <> || Auraiya Escort Service || <> || Azamgarh Escort Service || <> || Badaun Escort Service || <> || Bahraich Escort Service || <> || Ballia Escort Service || <> || Balrampur Escort Service || <> || Banda Escort Service || <> || Barabanki Escort Service || <> || Bareilly Escort Service || <> || Basti Escort Service || <> || Bijnor Escort Service || <> || Bulandshahr Escort Service || <> || Chandauli Escort Service || <> || Chitrakoot Escort Service || <> || Deoria Escort Service || <> || Etah Escort Service ||