Get Dropdown (Lookup) Options


I'm trying to migrate my Plumsail Forms Designer Javascript to the new Forms.
At the moment I am not able to get the options of a dropdown, to manipulate the values. The dropdown is filled by a list lookup field to another sharepoint list.

I started with a simple debug, which looks like

fd.spRendered(function() {
		function(field) {
			var options = $(fd.field("Hardware").$el).find("option");     
		    console.log(options); //--> length of options is 0
			setUserHardware(); //I want to manipulate the options          

It looks as if the content of the dropdown will be loaded afterwards.
Can you help me please? Thanks.

Dear @Hagrid,
Welcome to the community! Hope you enjoy using Forms. You are right though, some things are different. Lookup fields do not have all the options loaded when the form opens - they are dynamically retrieved when a user opens the dropdown/searches the field.

If you can tell me more about the case that you have, maybe we can help you with the code. If you absolutely have to have these values stored in the lookup field, you might be able to get them by sending a request to the list and retrieving the values directly, as opposed to getting them from the lookup.

If you instead want to do something with the presentation of options, or maybe exclude some options from the dropdown, this can be done without retrieving the values first.

Thanks for your input! I solved it by using the new "Extra Fields" and "Expand" function.

In the past I got the values by sending a request to the list and deleted the dropdown options, that were too much. But the new function allows me, to fill the drop down correctly from the beginning.


Dear @Hagrid,
Excellent news! We do strive to improve upon our products, and I'm happy to hear that the new features helped you in such a way :smiley:

If you'll have any other questions - let us know, we're happy to help!