Skip to main content
Nintex Community Menu Bar

Is it possible to clear value of lookup column?

  • Sep 15, 2017 10:16 PM UTC
  • 9 replies
  • 86 views
  • Translate All

Forum|alt.badge.img+3

I would like to reset or clear a lookup column that could have one or more values selected with causing a form save.

thank you

9 replies

Forum|alt.badge.img+14
  • Scholar
  • Sep 17, 2017 5:13 PM UTC

lookup column that could have one or more values selected

can you clarify that a bit more?

is it 'checkbox multi selection', 'list multi selection' or 'multi select'?

with causing a form save

as well for this - do you mean you hit a button, it clears lookup control and save form?

Translate

Forum|alt.badge.img+3
  • Author
  • Sep 18, 2017 11:56 AM UTC

Thank you Marian!

So I have a site lookup column that I want to have cleared or set back to "Please select a value..." if a checkbox is checked on (or a button clicked). This is the code I am using:

NWF$(document).ready(function(){

   NWF$('#'+cidContractor).change(function() {

      if(NWF$('#'+ cidContractor).prop("checked")) {
         NWF$('#'+ cidTraining).val("");
      }
   })
});

cidContractor is the checkbox and cidTraining is the lookup. It looks like the lookup value is just a string but it doesn't remove the value if I set the value to an empty string or "Please select a value...". So maybe it should be [0] position?

I think the second part of the question was a syntax error and that has been fixed.

Translate

Forum|alt.badge.img+14
  • Scholar
  • Sep 18, 2017 1:37 PM UTC

what form version are you on? solution is different for different versions.

as well, above you mentioned you have lookup multiselect capable. but from the screenshot it doesn't seem to be so.

can you for sure post its configuration.

Translate

Forum|alt.badge.img+3
  • Author
  • Sep 18, 2017 2:07 PM UTC

Thank you. Nintex Forms Version: 2.10.2.0. It's not multi-select, just a drop down lookup.

Translate

Forum|alt.badge.img+14
  • Scholar
  • Sep 18, 2017 4:01 PM UTC

ok, then following should reset lookup value

NWF$('#'+cidTraining).val("");
NWF$('#'+cidTraining).siblings('select.nf-client-control').val('**SelectValue**');
‍‍‍‍‍

‌ ‌ ‌ ‌ ‌ clear value‌ forms 2.9 and newer‌ ‌

Translate

Forum|alt.badge.img+3
  • Author
  • Sep 18, 2017 5:59 PM UTC

Amazing!! Thank you - again.

Is this thing: siblings('select.nf-client-control') documented somewhere? Like Nintex or JQuery?

Translate

Forum|alt.badge.img+14
  • Scholar
  • Sep 18, 2017 7:18 PM UTC

no it isn't.

and note it's valid just for current forms version(s). prior v2.9 the same was being achieved completely different way (that's why I asked for your forms version). and no one knows when nintex decides to change it again.

Translate

Forum|alt.badge.img+6

The jQuery.siblings() method is documented under docs.jquery.com Traversing section, I suppose. The DOM object(s) selector 'select.nf-client-control' (any element of node name 'select' that has 'nf-client-control' among its CSS classes) is based on the HTML markup generated by Nintex Forms and something that Nintex should document and keep consistent as much as possible.

Translate

Forum|alt.badge.img+3
  • Author
  • Sep 19, 2017 10:51 AM UTC

Thank you, that is very helpful!

Translate