Search code snippets, questions, articles...

Appu - JQuery Send On toggle button fix

function showRejectionModal() {
    var modalContainer = document.getElementById("rejectionModal")
    if (modalContainer) {
        modalContainer.classList.add("in")
        modalContainer.style.display = "block"
        modalContainer.querySelector(".modal-content").style.marginTop = "100px"
    }
    return false
}

function hideRejectionModal() {
    var modalContainer = document.getElementById("rejectionModal")
    if (modalContainer) {
        modalContainer.classList.remove("in")
        modalContainer.style.display = "none"
    }
}

function handleSendOnButtons() {
    var customSendOnButton = document.getElementById("hfSendOnBtn")
    var standardSendOnButton = document.querySelector(".workitem-footer button[data-am-smartuiaction='submit']")

    var dispositionEngineerElement = document.getElementById("$form.dispositionengineer.id");
    var workflowStep = document.getElementById("$params.taskid");
    
    //console.log(`Form disposition: ${"$form.dispositionengineer.id"}`)
    console.log(`Disposition engineer: ${dispositionEngineerElement}`)
    console.log(`Workflow Step: ${workflowStep}`)
    
    // Daniel: changing check to enter this logic (when no disposition is set, hide the appropriate button)
    if (dispositionEngineerElement.value === '') {
        console.log("Toggling view")
        console.log(dispositionEngineerElement)
        console.log("Value of the disposition engineering element: " + dispositionEngineerElement.value)
        
        // customSendOnButton.style.display = "none"
        standardSendOnButton.style.display = "none"
}
    else {
        standardSendOnButton.style.display = "inline-block"
    	/*
        if (dispositionEngineerElement.value == 'Reject') {
        //appu commented out as this is not a Reject per se
            //	customSendOnButton.style.display = "inline-block"
       		//	standardSendOnButton.style.display = "none"
    	}
    	else {
        	customSendOnButton.style.display = "none"
        	standardSendOnButton.style.display = "inline-block"
    	}
        */
    }
    

}

window.onload = function() {
    var customSendOnButton = document.getElementById("hfSendOnBtn")
    // appu commented out as this is not a Reject per se
    // customSendOnButton.parentNode.removeChild(customSendOnButton)
    // document.querySelector(".workitem-footer.cs-dialog.binf-modal-footer div").appendChild(customSendOnButton)
}

Fixes the code button such that the button for send on is toggled perfectly

Was this helpful?
0 Comments
Programming Feeds
Learn something new everyday on Devsheet