Hello everybody.
I would like to hide a custom *required element from my form. That element resides in the timeline and it is actually a check-point that I need to keep secret from the user, but also keep it functional. I understand that by making it visible/invisible, a field loses its required attribute, but I want to act on it with JS, while being hidden.I have the following code with which I tried unsuccessfully do it. I think I am missing some steps in my code to reach my element but I get neither the syntax nor the logic.
function hide_wo_checker(eContext){
formContext = eContext.getFormContext();
var woCheck = formContext.getAttribute("bw_workorderchecker2").getValue();
if { woCheck == null } { parent.document.getElementById("header_process_bw_workorderchecker2-header_process_bw_workorderchecker2-FieldSectionItemContainer").style.display = "none"; }
else {
// get the id of the generated from the rendered html
parent.document.getElementById("header_process_bw_workorderchecker2-header_process_bw_workorderchecker2-FieldSectionItemContainer").style.display = "none";
}
}
I tried finding how I could add some CSS but I could not find a something fast. (article/post/video/documentation about Client API & Power Apps on how to reach the css files and modify them or even add my own CSS stylesheet. So eitherway I am working for nailing it.
Not much to do with the above senario, but with the following code, i managed to change the BPF depending on category selection and is working good, with the auto-save function switched off into the system administration settings of the platform.
// JS source code for switching BPF
// Pass the name of the function to the library too
function onLoadChangeBPFByCategory(eContext){
//Get form context
var formContext = eContext.getFormContext();
//Get the field
var catype = formContext.getAttribute("bw_categoryid").getValue();
var catName = catype[0]['name'];
//Get the Process ID
var activeProcessID = formContext.data.process.getActiveProcess().getId();
//If category is not null ant the Process ID is not brochures -> set the process id to brochures (" * * ")
if (catName != null) {
if (catName == "Brochures" && activeProcessID.toUpperCase() != " * * ") formContext.data.process.setActiveProcess(" * * ", callBackFunction);
}
function callBackFunction(result) {
if (result == "success") {} else {}
}
}
Any insight in directions to find more about Client API or a learning sources will be really appriciated and helpful
Thanks in advance