JavaScript to update item list column from Nintex Form list lookup drop down list?

  • 12 November 2014
  • 6 replies
  • 14 views

Badge +2

JavaScript - new to Nintex and rookie at JavaScript.  Form has drop down list (ddlDTL).  You select an option from drop down list (DTL - date time location), and when you click SAVE button, we want to move the selected value of the ddlDTL to a column whose name is Date-Time-Location.  How to populate list column with ddlDTL selected value. ddlDTL is List Lookup control, created from a list view.


6 replies

Userlevel 7
Badge +17

I think you may not need to use JavaScript. But I want to understand your scenario and what you want to accomplish.

If you always want the list lookup drop down to appear on the form, and always want to save its value, then if you add a lookup field to the list, this will accomplish the same outcome. If you want the text value in another column along with the lookup selection, when configuring the list column, you can select fields to include, select the value you need.

Badge +2

Thank you very much for responding. Here is what I am trying to accomplish. This is my first form, too, so there may be a better method than what I started with.

Volunteer Signup sheet – very simple. Columns: Date-Time-Location (all in one); StaffName1; StaffPhone1; StaffEmail1; StaffName2; StaffPhone2; StaffEmail2

We need at least one person to sign up for this volunteer function. We encourage the primary person, StaffName1, to volunteer with a buddy, so we added staff person 2 fields. The phone number and email address columns will be used to send reminders to the person.

Date-Time-Location – we have approximately 200 slots. Once a Date-Time-Location slot is taken, we no longer want it to appear as an option on the list. We did not set up Date-Time-Location on a separate list as a lookup column for the staff list.

We will only give staff option to Edit – so they can see the date-time-location options and sign up for what is pre-populated on the list and not already taken.

We created a view of the Date-Time-Location column only and filter it on StaffName1 – only display if StaffName1 is empty. This view is used as the values in the List Lookup column on the form, which is rendering as a drop down list. The goal then was to take the selected value from the drop down list and tie it to the Date-Time-Location list item and save that item which would then be removed from the list view which populates the drop down. As I type this, I am not sure that is logical. I think the approach I am taking is somehow when staff select a value in the drop down list, it controls the item that is being edited. Are you suggesting the Date-Time-Location be on a lookup column? If so, once someone signs up, we no longer want the look up column available. There is still a need to flag the lookup column value as ‘used’ so don’t display it again. Would JavaScript be used for that?

Userlevel 7
Badge +17

I see what you are looking to do now. I think there are many ways to get to that goal. But I think what should drive it is how you want your users to interact with the list of slots/how to choose one.

This is just an idea. You mentioned Edit only ability. Perfect, then this is what I imagine. You have one list with all 200 slots. Each item is already created to define the slot times and locations. You have a field for Date and time, another for location. Location can be a choice field or single line of text, but go choice field. Have this split is an advantage. You can have a page in the site with multiple webparts connected to the list. One for each location to a filtered view. Or you can create a page per location with the list displayed and filtered to the location based on a view.

Or, as a cool solution (again, just an idea to give you options to think through, do what you want), Create a single page. Have two webpart on it. One is the list with the all fields in view, no filters. Add a Filter web part Query String filter. The term you are looking for in the query string is Location. Connect the two webparts with Location from Filter webpart will filter as a parameter to the list webpart. If you are still with me, now create a page elsewhere with a bunch of links. A link per location. Add to the page some instructions, images, light branding like "Select a location to volunteer at". Each link will be similar to /sites/volunteersite/Pages/Volunteer?Location=Atlanta. So this will take the user to the one page and filter the list with to just the location. With the Edit button as part of the view, the user clicks on an empty slot, or you include in the view a filter to show where Staffname1 is blank so they know which to choose. They fill out the form. In the form you can have datetime and location both as disabled fields so they do not change the value.

Hopefully this makes sense, and is of some kind of use. I wanted to put this down now as I thought of it. It may depend on the number of locations. If you have 10-20, should be a big deal. If you have 50, maybe you can group the links by region on the links page.

Or ignore this completely and we can collaborate on another solution.

Badge +2

Hi Andrew,

I took your advice and created them a site with the editform web part on it and utilized the connector web part to display only the dates for specific locations when they select the location.

Another question - they are trying the site and because the edit form is called using the Edit icon, it displays an overlay screen and when they click save the display pop up goes away, but the user remains on the original page.  All expected.  Now they want the edit form to possibly send a thank you message?  Thank you for volunteering.  They think the fact the page will remain displaying will cause confusion if there is no message telling them they successfully volunteered.  The workflow is being used and it is sending an email confirmation, but ...

Is this a case for java script on the save button - display a thank you html page?

What do you think?

Thanks,

Brenda

Userlevel 7
Badge +17

A fancy way would be to provide a ribbon button for the item. Instead of using the edit link, click a custom ribbon button for the selected item. The ribbon button is just custom javascript. It can open the edit form in modal, when the modal closes with a success it can update the built in notification bar with any text.

A different method would be to override the view with a dataview webpart and add a custom button or link next to each item to do the same thing. If this is SP2013, you could create a custom display template instead of editing the page in SPDesigner.

Userlevel 7
Badge +17

Another method that probably doesn't work, but it is worth mentioning. If you use the Nintex Form webpart, you can put forms in there and the webpart provides a way to provide a success message upon submit. But this is geared toward a form connected to a New item page, and not edit.

Reply