Removing Blank Entries from Drop Down of Embedded Data

Cathy395 IrelandCommunity Member Qubie ✭
edited July 8 in Custom Code

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.

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.

Would anyone have any idea of how to fix this issue?

Best Answer

  • grahulp5
    grahulp5 IndiaCommunity Member Guru ✭✭
    Accepted Answer

    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().


  • Cathy395
    Cathy395 IrelandCommunity Member Qubie ✭

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