Details of the issue:
A DataPage is using a custom script with a button that creates a record. The button is always passing the same ID as parameter to the results page, but it should pass the ID assigned to a chosen record. The record created by the button has a correct ID.
Expected Result: Correct ID is passed to the next page.
Actual Result: ID is passed incorrectly on the results page, but correctly on the created records.
Here is the Java Script that is not working. Can anyone look at this and determine why when the selection is made, that the correct Template ID is not passing? The passed ID is always the same, however the record that is created in the table is actually correct.
This is in the HEADER
<style>
thead th:nth-child(7) {
display: none!important;
}
.cbResultSetCalculatedField {
display: none !important;
}
.hidden {
display: none !important;
}
</style>
<style>
.cbResultSetTableHeader > th:nth-child(8), .cbResultSetDataRow td:nth-child(8), .cbResultSetTableHeader > th:nth-child(9), .cbResultSetDataRow td:nth-child(9) {
display: none;
}
</style>
This is a Calculated Field
CASE
WHEN [@field:SelectTemplate] = 'True'
THEN
''
ELSE
'hidden'
END
This is an HTML Block
<a class="[@calcfield:1]" href="https://www.bluefr8.com/post-template.html/?TN=[@field:TemplateNo]">POST TEMPLATE</a>
This is in the Footer
<!--
1. SelectTemplate checkbox is checked\unchecked automatically when editing record
2. Update button is renamed to "POST TEMPLATE"
3. When "POST TEMPLATE" button is clicked, user must be redirected to the following URL: https://www.bluefr8.com/post-template.html/?TN=[@field:TemplateNo]
-->
<script>
if (typeof addObserver == 'undefined') {
const addObserver = () => {
new MutationObserver((mutations)=>{
if (mutations[mutations.length-1].addedNodes.length>0) {
if (mutations[mutations.length-1].addedNodes[0].getAttribute('class') != null) {
if (mutations[mutations.length-1].addedNodes[0].getAttribute('class').indexOf('cbResultSetCancelButton')>-1) {
console.log(mutations[mutations.length-1].addedNodes[0])
document.querySelector('[name*="InlineEditSelectTemplate"]').click()
let updBtn = document.querySelector('input.cbResultSetModifyButton')
updBtn.value = 'POST TEMPLATE'
console.log("https://www.bluefr8.com/post-template.html/?TN="+"[@field:TemplateNo]")
updBtn.addEventListener('click', ()=>{
window.location.href = "https://www.bluefr8.com/post-template.html/?TN="+"[@field:TemplateNo]"
})
}
}
}
}).observe(document.querySelector('body'), {childList: true, subtree: true})
}
addObserver ()
}
</script>