Home › Forums › SPJS-Lookup › vLookup
- This topic has 54 replies, 2 voices, and was last updated 17 hours, 33 minutes ago by
Rad.
-
AuthorPosts
-
-
September 23, 2025 at 19:45 #38899
Hi, I am trying to build a form with a dropdown to select from then show related items in a Grid below allowing inline editing on certain fields. I was trying to use vLookup to achieve this. Do you happen to have an example for this setup?
-
September 23, 2025 at 19:59 #38900
I was able to setup the vLookup but trying to see how to show as a dropdown/grid view layout.
Please see the attached image – col2 will have the values for the dropdown to search from and rest of the columns will need to show in the grid.
Attachments:
-
September 23, 2025 at 20:51 #38904
In the classic DFFS vLookup you can use custom js to add inline editing as shown in this post: https://spjsblog.com/2019/08/31/vlookup-inline-editing-examples/
Alexander
-
September 23, 2025 at 22:29 #38905
thanks but how do I get the grid layout in order to display the related items for the search ?
Col2 (this will be the search drop down)
when a user selects an item from above dropdown, the below grid must refresh
col1 col3 col4 col5 col6…
-
September 24, 2025 at 00:44 #38906
pls ignore the above q, was able figure out the issue.
Diff q-
Tried setting up inline editing using
function edit_inline_multichoice(val, id, listGuid, fin, choices) {}
but getting below error
EditForm.aspx?List=…&ID=2&Source=…/DispForm.aspx%3FID=2&ContentTypeId=0x010040F651B0E5831C449C0AF0A0AD1E0C16:1 Uncaught ReferenceError: toggleEditField is not defined
at HTMLDivElement.onclick (EditForm.aspx?List=…=2&Source=/sites/…/DispForm.aspx%3FID=2&ContentTypeId=0x010040F651B0E5831C449C0AF0A0AD1E0C16:1:1) -
September 24, 2025 at 15:15 #38907
The function toggleEditField is in the code snippet in the top of the article I linked to – it must be included in the Custom JS of the form where you want to use the functionaltity.
Alexander
-
September 24, 2025 at 15:58 #38908
got it, thought it was an inbuilt function. Works great, thank you!
-
September 24, 2025 at 16:27 #38909
sorry a follow up on inline editing. I’ve a a few checkbox fields that need inline editing enabled but wonder if there’s a way to always have the checkbox show regardless of checked or not. Currently, it only shows if value is set.
Attachments:
-
September 24, 2025 at 17:28 #38911
so, if unchecked and saved, the checkbox goes away. I would like to have the checkbox always display (checked or not checked).
Attachments:
-
September 25, 2025 at 16:26 #38913
If you can show me the code you use for this field I’ll take a look – is it a boolean (Yes/No) field?
Alexander
-
September 25, 2025 at 18:27 #38914
it’s exactly what you’ve in https://spjsblog.com/2019/08/31/vlookup-inline-editing-examples/
function edit_inline_multichoice(val, id, listGuid, fin, choices) {
var dVal = val, arr = val.split(/<br\s*\/?>/i), b = [];
if (dVal === “”) {
dVal = ” “;
}
b.push(“<div style=’white-space:nowrap;’>”);
b.push(“<div class=’vLookupDispWrap’ onclick=’toggleEditField(this);’>”);
b.push(“<span class=’vLookupCurrVal’>” + dVal + ” </span>”);
b.push(“</div>”);
b.push(“<div class=’vLookupEditWrap’>”);
jQuery.each(choices, function (i, v) {
b.push(“<input id=’inline_” + fin + “_” + i + “‘ type=’checkbox’ value='” + v + “‘”);
if (jQuery.inArray(v, arr) > -1) {
b.push(” checked=’checked'”);
}
b.push(“/><label for=’inline_” + fin + “_” + i + “‘>” + v + “</label><br>”);
});
b.push(“<span title=’Save’ style=’cursor:pointer;margin:3px;color:green;font-weight:bold;’ onclick=’saveChangesMultichoice(this,\”” + fin + “\”,\”” + id + “\”,\”” + listGuid + “\”)’>✔</span>”);
b.push(“</div>”);
b.push(“</div>”);
return b.join(“”);
}function toggleEditField(elm) {
jQuery(elm).hide().next().show();
} -
September 25, 2025 at 18:58 #38915
this is how I am calling it:
function edit_inline_obenroll(val, item) {
var fin = “tstenroll”, choices = [“enroll”], id = item.get_item(“ID”);
return edit_inline_multichoice(val, id, listGuid, fin, choices);
} -
September 25, 2025 at 19:14 #38916
it’s currently not a yes/no but I can change it to Yes/No if that’ll allow the functionality I am looking for.
Also, wanted to point out something that’s not a big deal but nice to have – when using {“prefix”:”$”} within special config in vLookup tab, it keeps adding additional $ on save. As an example, if I save a value – $4000, the next time i refresh it shows $$4000. It would be nice to have a check if the $ already exists then not to add it.
-
September 25, 2025 at 19:34 #38917
apologies for multiple messages. I am trying to send as and when I see an issue. Will try to consolidate all next time.
I’ve some additional observations for special config field: the “nullToZero”:true doesn’t seem to work. When i delete an entry from a text field in vlookup it just removes the textbox control and doesn’t convert to 0.
this is how i have it setup
{“prefix”:”$”,”function”:”edit_inline_fn1″,”nullToZero”:true} -
September 26, 2025 at 16:00 #38925
Hi,
This inline editing is not an “official” solution so it is provided as a starting point for users that want to tinker with it.I can get you started by showing how you can have it show in edit mode all the time, but the functionality will not be optimal and it will require some more tweaks to work 100%.
Replace the function “edit_inline_multichoice” with this and you should see the checkboxes initially as readonly:
function edit_inline_multichoice(val, id, listGuid, fin, choices) { var dVal = val, arr = val.split(/<br\s*\/?>/i), b = []; if (dVal === "") { dVal = " "; } const buildOptions = (readonly) => { const buffer = []; choices.forEach((v, i) => { const inputId =inline_${fin}_${id}_${i}_${readonly ? "readonly" : ""}; buffer.push(<label><input id='${inputId}' type='checkbox' value='${v}'); if (arr.includes(v)) { buffer.push(" checked='checked'"); } if (readonly) { buffer.push(" disabled='disabled'"); } buffer.push("/>" + v + "</label><br>"); }); return buffer.join(""); } b.push("<div>"); b.push("<div class='vLookupDispWrap' onclick='toggleEditField(this);'>"); b.push(buildOptions(true)); b.push("</div>"); b.push("<div class='vLookupEditWrap'>"); b.push(buildOptions(false)); b.push(<span title='Save' style='cursor:pointer;margin:3px;color:green;font-weight:bold;' onclick='saveChangesMultichoice(this,"${fin}",${id},"${listGuid}")'>✔</span>); b.push("</div>"); b.push("</div>"); return b.join(""); }If you want to reload the vLookup table after save (to recalculate) you can change the function named “saveInline_vLookupChanges” by adding this line at the bottom (before the closing curly brace):
spjs.vLookup._init("Your_vLookup_field_name",false,true);Replace “Your_vLookup_field_name” with the actual name of your vLookup field.
Alexander
-
This reply was modified 3 months, 3 weeks ago by
Alexander Bautz. Reason: Fixed code snippet
-
This reply was modified 3 months, 3 weeks ago by
-
September 26, 2025 at 17:07 #38927
thanks, getting an error (for below line) – Unexpected Token {
inline_${fin}_${id}_${i}_${readonly ? “readonly” : “”};
-
September 26, 2025 at 18:39 #38928
Also, if I I changed the field to Yes/No Checkbox instead of a Choice field, will this function work?
-
September 26, 2025 at 20:12 #38929
It might be an issue with copying the code from my comment – try the attached version.
No, the code will not work for a yes/no field – it would have to be changed as the value on a boolean field (using this kind of code / api) is 0 for no and 1 for yes.
Alexander
Attachments:
-
September 26, 2025 at 20:40 #38931
works great! thank you so much! exactly what i needed.
one more q – Is there a code for inline editing for Numeric or Currency field?
I set up few currency fields as single line text in order to use the inline functionality and when using {“prefix”:”$”} within special config for a field, it keeps adding additional $ on save. As an example, $4000 is being saved as $$4000, $$4000 saved as $$$4000 and so on.
Attachments:
-
September 26, 2025 at 22:03 #38933
is there a way to hide the checkbox text value “Yes” in the display?
-
September 27, 2025 at 20:28 #38934
The text shown in the field is controlled in the custom function used for enabling the inline editing so you can control what is viewed and saved by changing the corresponding functions.
Just change the code to strip away the $ when enabling editing (or when saving the value).
Alexander
-
September 30, 2025 at 19:30 #38935
got it, thank you
-
October 1, 2025 at 17:43 #38936
hopefully this should be my final q around vlookup. Since vLookup renders as a table, is there a way to draw boxes around a group fields. For example, if I have 9 columns/fields. I would like to group them into 3 ad draw box around them or have title for each of the 3 groups.
I figured how to draw a borders around the vLookup table itself sing below code but need to group the fields now.
#sbs_FieldTable_MyvLookupTable {
border-top: 3px solid navy !Important;
border-radius: 5px !important;
border-left: 3px solid navy !Important;
border-right: 3px solid navy !Important;
} -
October 1, 2025 at 21:51 #38937
Not sure exactly what you mean – can you add a screenshot as an attachment (or email it to me) where you have marked the sections you want to add the border around?
Alexander
-
October 1, 2025 at 22:30 #38938
i would like to show some king of border to separate groups of 3 fields and have a Title on top like shown in the img.
Also, how do I change the background color of checkboxes in the vLookup from red to blue?
Tried below code for borders on right but didn’t work.
#dffs_vLookup_myVLookup table td:nth-child(2),
#dffs_vLookup_myVLookup table td:nth-child(3) {
border-right: 3px solid #444;
}Attachments:
-
October 2, 2025 at 17:07 #38940
i was able to figure out to draw borders around groups. Now I just need to know how to change checkbox background from red to blue.
-
October 2, 2025 at 17:32 #38941
You can style the background color like this in Custom CSS:
.childTableCell input[type='checkbox'] { accent-color: blue; } -
October 2, 2025 at 17:55 #38942
perfect, thank you!
-
October 3, 2025 at 01:07 #38945
sorry one more layout issue- the save checkmark appears on the right side for text boxes but it displays below for check box. I need them aligned on the right side like the textboxes.
Attachments:
-
October 3, 2025 at 16:26 #38950
You must use CSS on the HTML element wrapping the checkbox and the checkmark. Try either white-space:nowrap or display:flex.
Alexander
-
October 3, 2025 at 16:47 #38951
i did already try those but won’t work
-
October 4, 2025 at 07:35 #38952
Edit your Custom CSS and add this declaration to both .vLookupEditWrap and .vLookupDispWrap
white-space:nowrap;
-
October 6, 2025 at 16:05 #38954
didn’t work
-
October 6, 2025 at 21:42 #38956
Can you show me your function (edit_inline_multichoice if you still use the multichoice field) and your Custom CSS?
Alexander
-
October 8, 2025 at 16:32 #38957
function edit_inline_multichoice(val, id, listGuid, fin, choices) {
var dVal = val,
arr = val.split(/<br\s*\/?>/i),
b = [];
if (dVal === “”) {
dVal = ” “;
}const buildOptions = (readonly) => {
const buffer = [];
choices.forEach((v, i) => {
const inputId =inline_${fin}_${id}_${i}_${readonly ? "readonly" : ""};
buffer.push(<label><input id='${inputId}' class='cbDispWrap' type='checkbox' value='${v}');
if (arr.includes(v)) {
buffer.push(” checked=’checked'”);}
if(!spjs.dffs.data.isDispForm) {
buffer.push(” disabled=’disabled'”);
b.push(“<div class=’vLookupDispOnly’>”)
}
buffer.push(“/>” + “” + “</label><br>”);});
return buffer.join(“”);
};
b.push(“<div>”);
if(spjs.dffs.data.isDispForm){b.push(“<div class=’vLookupDispWrap’ onclick=’toggleEditField(this);’>”);};
b.push(buildOptions(true));
b.push(“</div>”);
b.push(“<div class=’vLookupEditWrap’ style=’white-space:nowrap’ display=’flex’;>”);
b.push(buildOptions(false));
b.push(<span title='Save' style='cursor:pointer;margin:5px;color:green;font-weight:bold;' onclick='saveChangesMultichoice(this,"${fin}",${id},"${listGuid}")'>✔</span>);
b.push(“</div>”);
b.push(“</div>”);return b.join(“”);
}.vLookupDispOnly{
padding-left:1.1em;
cursor:pointer;
width:100%;
box-sizing:border-box;
/* white-space: normal; */
white-space:nowrap;
color: gray;}
.vLookupDispWrap{
padding-left:1.1em;
padding-right:1.1em;
cursor:pointer;
width:100%;
box-sizing:border-box;
/* white-space: normal; */
white-space:nowrap;}
-
October 9, 2025 at 19:09 #38960
I have attached the function I tested with – there are some differences between the one you have and mine. The format of your code was a bit corrupted so if you need to post code, just save it in a .txt file and add it as an attachment.
Try the attached version and see if it makes any difference.
Alexander
Attachments:
-
October 10, 2025 at 00:24 #38962
perfect, this code seems to have fixed the issue. thank you so much
-
October 10, 2025 at 14:06 #38970
Thanks for the feedback – I’m glad it worked.
Alexander
-
October 10, 2025 at 16:24 #38971
q regarding vLookupIds – if I bulk loading recs, do the LookupIds need to be in the DFFS format or can it be a GUID?
-
October 10, 2025 at 19:01 #38973
I think that should be OK as long as the ID is unique.
-
October 21, 2025 at 22:58 #38992
hi, is there a limit for vLookup, like how many records can be associated to the parent and or how many can display?
-
October 22, 2025 at 15:34 #38993
Not really, but this being SharePoint it will start making it difficult if the list has more than 5000 items when you try to filter items. Index the fields you want to use as the connection between the two lists and it should be OK.
Alexander
-
-
November 10, 2025 at 17:33 #39010
Hi again, how do I reference an item in fld1 in a vLookup, corresponding to the item being edited in fld3?
vlookup
fld1 fld2 fld3-
November 10, 2025 at 18:30 #39011
You must get the value using code like this:
const row = document.querySelector("#vLookupTableRow_vLookupTasks_301"); if(row !== null){ const field = row.querySelector(".vLookupTasks_Number"); if(field !== null){ const val = field.innerText; console.log(val); } }Use the developer tools to inspect the table TR and TD to see the format of the id as it uses both the internal name of the vLookup, the item ID and the internal name of the field.
Alexander
-
-
November 12, 2025 at 16:57 #39012
for some reason, the logic const row = document.querySelector… returns a null although the element id does exist. See attaced screenshot.
Attachments:
-
November 12, 2025 at 17:20 #39015
Strange. Are you running the query in the console, or in custom js?
If you run it in the console you must ensure the devtools are connected to the correct context (if you open the vLookup in a dialog).
Alexander
-
November 12, 2025 at 17:26 #39016
custom js
-
November 12, 2025 at 17:28 #39017
I am in debug mode and stepping through the code so it’s connected
-
November 12, 2025 at 17:29 #39018
And the custom js is in the “parent” form and not the “child” form?
If so, you might have to wrap the code in a function to only run it after the vLookup table has been rendered on the page. See the user manual her: https://spjsblog.com/vlookup-for-sharepoint/vlookup-user-manual/#vLookupIsLoadedCallback
Alexander
-
November 12, 2025 at 18:59 #39019
Yes, but is the vLookup table showing on the form when you step through the code?
Email me some screenshots so I can see what you see on the screen.
Alexander
-
November 12, 2025 at 19:23 #39020
ah, its not. it’s in the refresh mode
-
November 12, 2025 at 20:05 #39021
got it working now. thank you!
-
January 21, 2026 at 16:49 #39072
Hi, the vLookup grid was working fine until today when i users are seeing the threshold error. What’s causing this and how can I resolve it?
Attachments:
-
January 21, 2026 at 16:51 #39074
You must index (in list settings) the field used as filter on the vLookup config.
Alexander
-
January 21, 2026 at 17:17 #39075
thank you, that resolved it
-
-
AuthorPosts
- You must be logged in to reply to this topic.







