hi aamir,
if your request area field would be a dtlDropdown you would be able to build up a list of onchange Functions (
evt="onChange='emp_change_category_func('cr');toggleFields(this);'"), because at runtime on browser side all shown entries of the dropdown are well known (name and id of each entry) and you could check/test in your onchange function that values.
but in your case, it's a dtlHier which works in a completly different approach. if you use a dtlHier, the browser couldn't know at runtime, which entry will be choosen from employee, so in that case, the dtldHier field have to find the the correct dataset from input. for this, there are two ways:
first, the employee could know the name of a category and put the name into the input field. then his input will be checked with data in db. if there is such a category, the system overrides this with the value from db (even, if this value is exactly the same provided by the employee).
second, the employee klicks on the label to get a list of available categories. in this case, the system waits for the clicked/choosen category and populates the input field with that one.
so, in both ways there is a time, when the browser "knows" which category was choosed and populates the input field with this value. thats right the time we can act. fortunatly, there is a short function working at this exact moment, we can modify. that function is defined as CategorySink.prototype.update_ss_ca_field (NX_ROOT/bopcfg/www/wwwroot/scripts/cst_cat.js, or if you want a more readable version NX_ROOT/sdk/scripts/cst_cat.js). you can copy this function to your detail_cr_htmp right after the scripts include area.
add something like
if(cat_sym == "Internet Access") {
toggleFields();
}
hopefully this works :)
regards
pacy
------------------------------
Senoir Consultant
Fujitsu
------------------------------
Original Message:
Sent: 06-28-2019 01:55 AM
From: Aamir Khan
Subject: Fields Visibility on specific Request Areas
@Marc Horlomus can you pls advise
Original Message:
Sent: 06-27-2019 09:46 AM
From: Aamir Khan
Subject: Fields Visibility on specific Request Areas
Hi Brian
i did something like below but for another custom field and it worked fro me...but im wondering for " Request area field" that how can i put the same condition (evt="onChange='toggleFields(this);'") since Request Area pdm macro already has evt
Please help.
<PDM_MACRO name=dtlDropdown hdr="Create Org VDC Network" attr="zVDCNetwork" default="Yes" evt="onChange='toggleFields(this);'">
<script>
function toggleFields(selector){
var name_txtBox = document.getElementsByName("SET.zVDCNetwork_name")[0];
var iprange_txtBox = document.getElementsByName("SET.zVDCNetwork_iprange")[0];
var subnet_txtBox = document.getElementsByName("SET.zVDCNetwork_subnet")[0];
if(selector.options[selector.selectedIndex].text === "Yes")
{
name_txtBox.style.display = "block";
iprange_txtBox.style.display = "block";
subnet_txtBox.style.display = "block";
}
else
{
name_txtBox.style.display = "none";
iprange_txtBox.style.display = "none";
subnet_txtBox.style.display = "none";
} }
</script>
Original Message:
Sent: 06-27-2019 09:05 AM
From: Brian Mathato
Subject: Fields Visibility on specific Request Areas
Hi Aamir,
Have you looked into the PDM_IF macro which you can wrap around the two fields?
------------------------------
===
Kind Regards,
Brian
Original Message:
Sent: 06-27-2019 08:10 AM
From: Aamir Khan
Subject: Fields Visibility on specific Request Areas
Hi
We have some requirement on employee role for creating a request. We have some particular custom fields which should only be visible when Request Area is (USB Access) or (Intenet Access)
Below we have custom fields on detail_cr.htmpl (employee)
<PDM_MACRO name=dtlHier hdr="Sites" attr="zSite">
<PDM_MACRO name=dtlDropdown hdr="Portal Login" attr="zPortalLogin">
The above 2 fields should be visible when user select request area "USB Access" or "Internet Access". for Only these 2 Request areas the above fields should be visible otherwise not.
How can i achieve this? i can see there is already evt applied on Request Area . Please can any one help.
<PDM_MACRO name=dtlHier hdr="Request Area" attr="category" autofill=yes common_name="ss_sym" evt="onChange=\\\"emp_change_category_func('cr')\\\"" factory=pcat_cr_ss size=30>
#caitsm
#caservicedesk17.0