Available choices in Dropdown
I am trying to limit the available choices in a single choice field on a specific form set, I have tried the following but they don't seem to do anything...
and
Help Appreciated.
Thanks
Code: Select all
fd.field('Follow_x0020_up_x0020_Action').control()._el().find('select option:eq(1)').hide();
Code: Select all
fd.field('Follow_x0020_up_x0020_Action').control()._el().find('select option[value="Book an Appointment"]').hide();
Help Appreciated.
Thanks
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Hello, Tony!
Try it out from the console. I've tried your first code snippet and it worked just fine for me, perhaps the name of the field is not right? And is it a regular dropdown choice menu or some more specific field, e.g. a lookup or something similar?
Try it out from the console. I've tried your first code snippet and it worked just fine for me, perhaps the name of the field is not right? And is it a regular dropdown choice menu or some more specific field, e.g. a lookup or something similar?
Cheers
Hi Nikita,
I've double checked the name and copied and pasted it from the Forms Designer to ensure it is correct, it is definitely just a regular single choice field. If I enter either of the above into the console it returns
If that means anything to you?
Thanks again
I've double checked the name and copied and pasted it from the Forms Designer to ensure it is correct, it is definitely just a regular single choice field. If I enter either of the above into the console it returns
Code: Select all
[object Object]{0: HTMLOptionElement {...}, context: Document {...}, jquery: "1.11.3", length: 1, prevObject: Object {...}, selector: ".fd_field[f..."}
Thanks again
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Yes, it returns the object that it hides, in case you want to do something else with it. If you check dropdown box again, it shouldn't have this option available anymore. It will not change the selected item though, even if you just removed the selected item from choice.
You can also try remove() instead of hide(), it should also work.Cheers
Hi Nikita,
Thanks for the help, for your info changing the code to use remove() did the trick, even pasting the code with hide() into the console then checking did not work, I did it several times from 0-6, there are 7 items in the choice list and it did nothing...
Thanks
Thanks for the help, for your info changing the code to use remove() did the trick, even pasting the code with hide() into the console then checking did not work, I did it several times from 0-6, there are 7 items in the choice list and it did nothing...
Thanks
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Alright, good to know! Perhaps it's a browser difference, using remove should do the trick in all situations.
Cheers
-
- Information
-
Who is online
Users browsing this forum: No registered users and 11 guests