Removing Blank Entries from Drop Down of Embedded Data | XM Community
Skip to main content
Solved

Removing Blank Entries from Drop Down of Embedded Data

  • June 30, 2021
  • 2 replies
  • 233 views

I'm looking for some assistance with removing blank entries from an embedded data drop down list.
I have created a product servicing form which includes a list of questions that must be completed for each product a person wishes to get serviced. I have used branch logic so that if a person has 2 products that are either different or the same, they will see different questions. If a product is the same as a previous one, I have created a drop down using javascript that includes embedded data that has been piped from previous answers. I have included an image of the code I am currently using.
Screenshot 2021-06-30 at 11.27.07.pngScreenshot 2021-06-30 at 11.27.24.png
For each new product, I am including an extra embedded data field from the previous response. The issue that I am experiencing however, is that if someone chooses the option of the product being the same as a previous one, the dropdown for the next product will have a blank space.
Screenshot 2021-06-30 at 11.39.54.png
Would anyone have any idea of how to fix this issue?

Best answer by grahulp5

You can check for the empty embedded fields and don't add them or you can run a function for each items in drop down to check if .length<=0 then .hide().

2 replies

grahulp5
QPN Level 3 ●●●
Forum|alt.badge.img+13
  • QPN Level 3 ●●●
  • Answer
  • July 13, 2021

You can check for the empty embedded fields and don't add them or you can run a function for each items in drop down to check if .length<=0 then .hide().


  • Author
  • July 22, 2021

grahulp5 thank you for your help with this. I will give it a go and see how I get on!