DOM manipulation script to work in workspace

D Sha
Tera Contributor

How can we make a DOM manipulation script work in a workspace as well as platform view? 

The UI type for the client script is All

Any leads will be much appreciated.

4 REPLIES 4

Community Alums
Not applicable

Hi @Dhriti Sharma ,

What is your exact requirement ? what you want to achieve?

 

D Sha
Tera Contributor

So I have to hide the hours, min, sec for a duration field and only the days should be visible. 

the client script I used for that :

function onLoad() {
var doc = g_form.getControl("duration").ownerDocument,
win = doc.defaultView,
table = g_form.getTableName(),
hideHoursMinSecFields = function (field) {
function getElem (field, suffix, prefix) {
return doc.getElementById((prefix || "") + table + "." + field + (suffix || ""));
}
var controlHour = getElem(field, "dur_hour", "ni."),
controlMin = getElem(field, "dur_min", "ni."),
controlSec = getElem(field, "dur_sec", "ni."), cs;

if (controlHour != null && controlHour.style != null) {
controlHour.style.display = "none";
}

if (controlMin != null && controlMin.style != null) {
controlMin.style.display = "none";
}
if (controlSec != null && controlSec.style != null) {
controlSec.style.display = "none";

}
};
hideHoursMinSecFields("duration");
hideHoursMinSecFields("work_duration");

 

again, I am not able to remove the hour label, that's another issue. 

find_real_file.png

But here I want the same to get reflected on the workspace as well. 

Is there an option to do that? 

I need to see the days only for a duration field in both workspace and UI view

Dana Falah
Tera Contributor

did u find that we can use Dom manipulation in workspace?

D Sha
Tera Contributor

No as far as I know it doesn't work in workspace