DesiLogi Posted September 1, 2020 Report Share Posted September 1, 2020 Hello, I'm trying to reference a field, in a Details datapage, that is a cascading dropdown (the field is a text field called 'Area'). I need to disable it conditionally using javascript (I've found that when there are a lot of Rules it significantly slows the datapage loading compared to using js, so I need to use js to do this). I've been able to do this no problem with regular text fields and dropdowns but can't get it to read the cascading dropdown. I've been trying to use something like: var v_area = document.getElementsByName("EditRecordArea")[0]; along with the disable code in an if/then clause v_area.disabled=true; Does anyone know how to alter the above to be able to use it in js? Many thanks! Quote Link to comment Share on other sites More sharing options...
Vitalikssssss Posted September 22, 2020 Report Share Posted September 22, 2020 Hi @DesiLogi, It is possible with JavaScript to disable Cascading dropdown, however I would recommend using a Cascading TextField that has an option to disable the input field if only one option returned. If my suggestion does not fit your workflow than you can use the following JavaScript: <script> document.addEventListener('DataPageReady', function (event) { const el = document.querySelector('select[id^="InsertRecordYOUR_FIELD"]'); el.addEventListener('change', ()=>el.disabled="true"); }); </script> Regards, vitalikssssss Quote Link to comment Share on other sites More sharing options...
DesiLogi Posted November 16, 2020 Author Report Share Posted November 16, 2020 Hi Vitalikssssss, Sorry it took so long to reply--I stopped getting notifications for thread updates for some reason. Many thanks for posting this code- I have to use drop downs for data choice reasons so I'll give this a shot. Very much appreciate it! Best, Kevin Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.