Control a Lookup List Drop Down Field with Button

  • 17 August 2022
  • 0 replies
  • 128 views

Hey All,

Hopefully a simple question, though I have been bashng my head against a wall trying to figure this one out.

 

I have a Sharepoint List called: colours

In the Title Field I have listed some colours : Red, Blue Yellow etc

 

I have a second SharePoint List called: colourNumbers

In the Title field I have a simple number: 11, 23, 44

I then have a lookup field called: Colours which references the colours SharePoint list

 

this gives me a results similar to this

 

Title Colours
11 Red
22 Blue
33 Yellow

 

Right clear so far.

In my Nintex form I have a List lookup field (dropdown) connected to the colours Sharepoint list populating the field with the colours from the lists Title field - Let's call this field colourLU - All good, nice and easy!

 

I then have a second List lookup field (Option buttons) connected to the colourNumbers Sharepoint list.  This list field isdisplaying the Title field from the list but is filtering tthe colour value from colourLU filed and Colour field from the list. Let's call this field colourNumbSelct - so far again nice and simple and basic function.

 

 

 

If I change value in the colour dropdown menu (colourLU) , the second lookup Option button field (colourNumbSelct) refreshes and shows the appropriate value.  If I jump back into Sharepoint and edit the numerical value of any of the numbers, by clicking to another value and clicking back on the colour, that new value has updated! - Cool

 

so what's the problem?

 

I would like to learn how to set the value fo the first dropdown lookupfield, by pressing a button!

Why? - long story, but if I can get this working I can go into more detail

 

So I have added a button to the form, set the functon of this button to Javascript running a value called ryanFunc();

 

the the forms Javascript section I have used the following code:

 

 

function ryanFunc(){ var selectField = NWF('.' + 'ccColourLU'); selectField[0].selectedIndex = 0; }

 

 

ccColourLU is a CSS Class I assigned the Lookup Dropdown field

When I click the button the field does indeed change and the text displayed goes back to the default "Please select a value...." state.

 

However the second lookup Option button value does not change!

 

So what am I missing?

 

When I manually change the value of the colour drop down then second lookup refreshes and shows the current value.  When i use the button I would expect the second value to refresh and display the appropriate value.  I have tried changing the index number to different values, but wanted to start with essentially resetting the field. 

 

I know that setting the index value is actually setting it to the ID value of the Sharepoint list, but I can;t seem to find the syntax for either locking that in like a click event or is just setting the index not actually setting the value and other associcated properties required to update the second field

 

Any ideas anyone?

 

Happy to upload a video of my issue if that would help illustarte what I am trying to do

 

Cheers

Ryan

 


0 replies

Be the first to reply!

Reply