roattw Posted September 28, 2022 Report Share Posted September 28, 2022 I have an employee status checkbox (Y/N) showing they are Active when checked. I would like to have that checkbox become deselected when a "Termination Date" is entered in a calendar popup. Not finding a clear wau to accomplish this. Many thanks! Quote Link to comment Share on other sites More sharing options...
0 Ilyrian Posted September 29, 2022 Report Share Posted September 29, 2022 Hi @roattw You can add the script below to your Header or Footer. Please change EditRecordDate1 and EditRecordYesNo1 to your respective IDs. <script type="text/javascript"> document.addEventListener('DataPageReady', function (event) { var txtDate = document.getElementById('EditRecordDate1') if (!txtDate.value) { document.querySelector('#EditRecordYesNo1').checked =true; } txtDate.addEventListener('change', function() { if (!txtDate.value) { document.querySelector('#EditRecordYesNo1').checked = true; } else { document.querySelector('#EditRecordYesNo1').checked = false; } }); }); </script> Quote Link to comment Share on other sites More sharing options...
0 roattw Posted September 29, 2022 Author Report Share Posted September 29, 2022 Thanks your this script! It doesnt seem to be working. Does it matter that this is in the "Deatails" page and notf general DP? Quote Link to comment Share on other sites More sharing options...
0 Ilyrian Posted September 30, 2022 Report Share Posted September 30, 2022 14 hours ago, roattw said: Thanks your this script! It doesnt seem to be working. Does it matter that this is in the "Deatails" page and notf general DP? I have implemented the same code in a Details Page. In the following link https://c8cmr089.caspio.com/dp/02cab000b171d58801584f06906c you can check the solution. Quote Link to comment Share on other sites More sharing options...
0 roattw Posted September 30, 2022 Author Report Share Posted September 30, 2022 Hmm. Just not sure how mine is different and not working. Field names all correct. Wonder if its because this DP is intially filtered by that field Im trying to check/uncheck, only showing "active" people so maybe it cant change that value when already being used in the filter. - "Active" Quote Link to comment Share on other sites More sharing options...
0 roattw Posted September 30, 2022 Author Report Share Posted September 30, 2022 Interesting twist. I had a typo in the script. Fixed that. Didnt work. I added a second checkbox field Active2, changed the script to that '#EditRecordActive2' and it worked fine. But it just wont work on that first Active checkbox. I even removed "Active" as a search filter for the data and still not working. There is something ablout that initial Active field it doesnt like. Quote Link to comment Share on other sites More sharing options...
0 CoopperBackpack Posted October 3, 2022 Report Share Posted October 3, 2022 Hello @roattw, As I can see on your screenshot the field name is Termination_date. The syntax to select the fields with the 'Text Field/Text Area/Dropdown/Checkbox/Listbox/Hidden' From element on the Details DataPage is EditRecordFIELDNAME So, var txtDate should be: document.getElementById('EditRecordTermination_date'). Hope this fixes the issue. Ilyrian 1 Quote Link to comment Share on other sites More sharing options...
0 roattw Posted October 20, 2022 Author Report Share Posted October 20, 2022 Again, thanks for the help. Just wont work on mine for some reason. Triple checked my values and even recopied and applied your script. Just wont change it. Fascinating. Quote Link to comment Share on other sites More sharing options...
0 CoopperBackpack Posted October 31, 2022 Report Share Posted October 31, 2022 Hi @roattw, I tested the script on the sample DataPage and it works on my side. It should work if both fields are editable (Active and Termination_date). Please test the following script: <script> document.addEventListener('DataPageReady', checkboxHandler); var terminDate = document.getElementById('EditRecordTermination_date'); function checkboxHandler() { terminDate.addEventListener('change', function() { if (terminDate.value == '') { document.querySelector('#EditRecordActive').checked = true; } else { document.querySelector('#EditRecordActive').checked = false; } }) document.removeEventListener('DataPageReady', checkboxHandler); }; </script> roattw 1 Quote Link to comment Share on other sites More sharing options...
0 roattw Posted November 1, 2022 Author Report Share Posted November 1, 2022 Success! Thank you so much! Quote Link to comment Share on other sites More sharing options...
Question
roattw
I have an employee status checkbox (Y/N) showing they are Active when checked.
I would like to have that checkbox become deselected when a "Termination Date" is entered in a calendar popup.
Not finding a clear wau to accomplish this.
Many thanks!
Link to comment
Share on other sites
9 answers to this question
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.