Hide "Add New" vLookup button based on query results

Forums vLooup for SharePoint Hide "Add New" vLookup button based on query results

This topic contains 2 replies, has 2 voices, and was last updated by  Chris Diltz 2 months, 1 week ago.

  • Author
    Posts
  • #18030

    Chris Diltz
    Participant

    Does anyone know of a way to hide the “add new item” button in vLookup based on the query results? My use case: If an item already exists matching the query, disable the button so that another item is not added, limiting the user to one entry per query.

  • #18120

    Alexander Bautz
    Keymaster

    There is no built in function you can use, but maybe you can use something like this:

    var vLookupHideNewItemBtnTicker = setInterval(function(){
    	if(spjs.vLookup.dataObj.vLookupTasks !== undefined){
            if(spjs.vLookup.dataObj.vLookupTasks[spjs.dffs.data.thisItemID].count > 0){
                jQspjs("#newItemWrap_vLookupTasks").hide();
                clearInterval(vLookupHideNewItemBtnTicker);
            }
        }
    },1000);

    Change “vLookupTasks” to match your field name.

    Alexander

You must be logged in to reply to this topic.