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.
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.
Hi Sofoklis Papaioannou,
It seems that you want to do something when BPF move to a specific step, correct?
If so, you could refer to this API doc:
There are some events, I think it could help you.
Steve this is great. It does work that way. As it is noted in your editor, I had to replace the curly braces with parenthesis in line 7. I really appreciate what you did there.
I was trying to somehow force it with onDocument.ready but i think our setup lacks JQuery (It was not my responsibility to set it up).
Your code is working but I am getting errors until I get to the stage where that field renders. So now I want to make my script "kick in" if it reaches that stage. Do you know where I can find methods and generally documentation/resources on how to manipulate these forms, using JS?
Here is the the stage where the element renders
Hi Sofoklis Papaioannou,
I ever got undefined when I want to get element by the code parent.document.getElementById(""). This is due to when the onload function is triggered, the Dom isn't got ready. So when you try to get element, it would return undefined.
You can try this code to test:
function hide_wo_checker(eContext){
formContext = eContext.getFormContext();
var woCheck = formContext.getAttribute("bw_workorderchecker2").getValue();
if { woCheck == null } {
setTimeout(
function(){
var element = parent.document.getElementById("header_process_bw_workorderchecker2-header_process_bw_workorderchecker2-FieldSectionItemContainer");
console.log(element);
element.style.display = "none";
}, 3000
);
}
else {
// get the id of the generated from the rendered html
setTimeout(
function(){
var element = parent.document.getElementById("header_process_bw_workorderchecker2-header_process_bw_workorderchecker2-FieldSectionItemContainer");
console.log(element);
element.style.display = "none";
}, 3000
);
}
}
Hello Steve!
1. Yes it is an onload event
2. Yes that element is in the timeline
3. Yes, it returns undefined
Hi Sofoklis Papaioannou,
Some question:
1. Is this function an onload event?
2. Is the element "header_process_bw_workorderchecker2-header_process_bw_workorderchecker2-FieldSectionItemContainer" in the timeline?
3. Did you console.log(parent.document.getElementById("header_process_bw_workorderchecker2-header_process_bw_workorderchecker2-FieldSectionItemContainer"))? What's the result? Undefined?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156