Hide "Add New" vLookup button based on query results

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

Viewing 1 reply thread
  • 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

      Viewing 1 reply thread
      • You must be logged in to reply to this topic.