kpcollier Posted October 9, 2019 Report Share Posted October 9, 2019 I'm trying to make a simple 'counter' style workflow on my page. It is a Letter Style page that is meant to be downloaded and printed out. What I am trying to do is differentiate what records have been printed and what records have not been. I've created a field in my table called Print_Checkbox that I was going to use for this. I wrote a little script trying to get it to work, however I freakin suck at this compared to you guys. I can't get it to work, but I feel it is something simple in my script that needs to be changed. var clickHere = document.querySelector('[id*=DataDownloadButton]'); // id of download button var pCheckBox = document.getElementById('EditRecordPrint_Checkbox'); // id of newly made Print Checkbox clickHere.onclick = function (){ pCheckBox.value = true; }; I don't get any errors in the console, but the checkbox is not being checked. Any help is appreciated! Quote Link to comment Share on other sites More sharing options...
Vitalikssssss Posted October 10, 2019 Report Share Posted October 10, 2019 Hi @kpcollier, What datapage type do you use? Quote Link to comment Share on other sites More sharing options...
kpcollier Posted October 10, 2019 Author Report Share Posted October 10, 2019 40 minutes ago, Vitalikssssss said: Hi @kpcollier, What datapage type do you use? It is a List Report datapage. Quote Link to comment Share on other sites More sharing options...
kpcollier Posted October 10, 2019 Author Report Share Posted October 10, 2019 I've also tried this little guy, with no luck. Also no errors whatsoever in the console. document.getElementsByClassName('DataDownloadButton').onclick = function clickThis() { document.getElementById('EditRecordPrint_Checkbox').value = true; } Quote Link to comment Share on other sites More sharing options...
DefinitelyNot31337 Posted October 10, 2019 Report Share Posted October 10, 2019 Do you have a Separate List DataPage and (Single-Record Update, or Details DataPage)? I assume you have two DataPages since you can't have Inline Edit on List DataPage. In this case, you would need some interface to have the two connected to each other. Let me know if you have the deployed the SRU/Details DataPage as an iframe, or as embed on the same page as the List DataPage. Also, let me know if my assumption is correct. Quote Link to comment Share on other sites More sharing options...
kpcollier Posted October 10, 2019 Author Report Share Posted October 10, 2019 23 minutes ago, DefinitelyNot31337 said: I assume you have two DataPages since you can't have Inline Edit on List DataPage. I only have one datapage, and it is a List Report. I never thought of the Inline Edit (which, I see now is probably effecting the way I am calling the checkbox element) because I didn't need it. All this page does is fill in a couple fields into a document to be printed - nothing is edited, and the only thing a user can do on this page is click on the print button. *Edit Now I am understanding this more. Since there is no inline edit, which I originally thought I didn't need, I cannot change the value of the checkbox. Alright, now this sucks. Lol. Quote Link to comment Share on other sites More sharing options...
kpcollier Posted October 11, 2019 Author Report Share Posted October 11, 2019 (edited) I'm trying to think of a way to do this. I can do Bulk Edit on a List Report, which I think miiiiiiight work. I'm trying to make a script that, upon the click of the DataDownloadButton, opens the bulk edit and checks the Print_Checkbox with an auto-submit button, then opens up the PDF generator. I'll update this post with what I find out. *Edit I've pulled in a lot of information and different scripts to get this going on the right track. I think. I used DN31337 auto select all script for both selecting all records on the results page and also for clicking the Print_Checkbox. I then used another script I found here to click the the Bulk Edit button. I am now trying to get this all wrapped in a click event for when the Print/Download button is clicked. I was thinking I might create a fake button to overlap the download button, then have an auto-click script to click the actual print/download link after the bulk edit is done. //Needs to happen before Print Button Is Clicked //Automatically select all for bulk edit var check_all = document.querySelector(`[action*="[@cbAppKey]"] [type=checkbox][id*="HCB"]`); setTimeout(checker, 500); function checker() { check_all.click(); } //When Print Button Is Clicked Need wrapped in click event //Open Grid Edit automatically - changed for Bulk Edit function openBulkAutomatically(delay) { setTimeout( function() { var bulkEditButton = $("[data-cb-name='BulkEditButton']")[1]; if (bulkEditButton) f_dispatchEvent(bulkEditButton, "click"); }, delay ? delay : 500); } function f_dispatchEvent(v_element, v_type){ if(v_element.dispatchEvent) { //var v_e = new Event(v_type); var v_e = document.createEvent('MouseEvents'); v_e.initEvent(v_type, true, true); v_element.dispatchEvent(v_e); //new Event(v_type, {"bubbles":true, "cancelable":true}) } else if(v_element.fireEvent){ v_element.fireEvent('on' + v_type); } }; openBulkAutomatically(); //Afer Print Button Is Clicked //Click Printed Checkbox var check_print = document.querySelector(`[action*="[@cbAppKey]"] [type=checkbox][id*="EnableBulkEditPrint_CheckboxCkb"]`); setTimeout(checker, 500); function checker() { check_print.click(); } Right now, this script will select all records, bring up the Bulk Edit screen and select the printed checkbox as soon as the page loads. Edited October 11, 2019 by kpcollier Updated workflow 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.