kpcollier Posted February 6, 2019 Report Share Posted February 6, 2019 I had this working with one table and one field, but now I have two tables and two fields. I tried fixing it, it didn't work. Tried reverting to the old one, and now that stopped working. So I am totally lost. I have a web form. The form has a dropdown for where you can select a Job. I have a button inside of a html block in this form. First you select the job, then click the button. The Job is the parameter being sent through the URL. When clicked, a page will popup and display results of all records matching that Job. I am working with the fields Job, Ordering_Table_Test_Job, and Ordering_CompletedOrders_Job. Here is the script I am working with and cannot get any records from. My view has 4 records inside of it. After checking, it looks like the query string values are being passed through the url however I still get no results. I have tried going back to just one parameter like before, and now it still says no results. So I feel I really messed something up. <script> var fieldName = "Job"; // The name of your table field. var paramName = "Ordering_Table_Test_Job"; // The name of your parameter var paramNameTwo = "Ordering_CompletedOrders_Job"; // second parameter /* No modifications necessary beyond this line */ var inputField = document.querySelector('[action*="[@cbAppKey]"] #InsertRecord' + fieldName); var linkToChild = document.querySelector('[action*="[@cbAppKey]"] #linkToChild'); var baseUrl = linkToChild.href; //do not touch var moddedUrl = baseUrl; //do not touch function updateLink() { moddedUrl = `${baseUrl}?${paramName}=${this.value}?${paramNameTwo}=${this.value}` } ['change', 'keydown','keyup'].forEach( function(e) { inputField.addEventListener(e, updateLink); }); inputField.dispatchEvent(new Event('change')); linkToChild.onclick = function() { window.open(moddedUrl, '', 'resizable=no,status=no,width=500,height=500,scrollbars=no,dependent=no'); return false; } </script> Quote Link to comment Share on other sites More sharing options...
kpcollier Posted February 6, 2019 Author Report Share Posted February 6, 2019 I was able to get records to show up with one variable. However it is still finicky and showing some results for the wrong job. Here is the script. <script> var fieldName = "Job"; // The name of your table field. var paramName = "Ordering_Table_Test_Job"; // The name of your parameter /* No modifications necessary beyond this line */ var inputField = document.querySelector('[action*="[@cbAppKey]"] #InsertRecord' + fieldName); var linkToChild = document.querySelector('[action*="[@cbAppKey]"] #linkToChild'); var baseUrl = linkToChild.href; //do not touch var moddedUrl = baseUrl; //do not touch function updateLink() { moddedUrl = `${baseUrl}?${paramName}=${this.value}` } ['change', 'keydown','keyup'].forEach( function(e) { inputField.addEventListener(e, updateLink); }); inputField.dispatchEvent(new Event('change')); linkToChild.onclick = function() { window.open(moddedUrl, '', 'resizable=no,status=no,width=500,height=500,scrollbars=no,dependent=no'); return false; } </script> Quote Link to comment Share on other sites More sharing options...
kpcollier Posted February 7, 2019 Author Report Share Posted February 7, 2019 So, it looks like the parameters are being passed with the second variable. However, something in the function isn't right, because it still loads no results. Quote Link to comment Share on other sites More sharing options...
kpcollier Posted February 7, 2019 Author Report Share Posted February 7, 2019 I was able to get this to work. I used the same script with the paramNameTwo variable, but replaced the ? with an ampersand. 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.