<script>
/* var UWStatus = rbf_getPicklistCode("UW_Status");
if (UWStatus == "CTC - PTF|CTC" || "CTC - UTR|CTCUTR") {
$("#rbi_branch_pricing_concession").hide();
$("#rbi_loan_discount_fee").hide();
} else {
$("#rbi_branch_pricing_concession").show();
$("#rbi_loan_discount_fee").show();
}*/
</script>
I've created this condition
e,g : If the field UW Status = CTC - PTF|CTC || CTC - UTR|CTCUTR
hide 2 fields from the page or make the text box readonly....
Hello,
What problem do you see when using this code?
Regards,
Karthikeyan
Hi,
Read your code from the start all the way to the end, I'm sure you will see the error.
Regards
Charlton Santana
Shouldn't this
if (UWStatus == "CTC - PTF|CTC" || "CTC - UTR|CTCUTR") {
be
if ((UWStatus == "CTC - PTF|CTC") || (UWStatus == "CTC - UTR|CTCUTR"))
-Regards.
well I've read it couple of times and Not able to find out where am I going wrong.
The very same code use to work on the page earlier but not anymore.
@karthikeyan : Well there is no error in the page but based on the condition the fields must be invisible in this case its not happening.
The fields are very much visible even with the conditions match 100%
Try this code
<script>
var UWStatus = rbf_getPicklistCode("UW_Status");
if (UWStatus == "CTC - PTF|CTC" || UWStatus == "CTC - UTR|CTCUTR") {
$("#rbi_branch_pricing_concession").hide();
$("#rbi_loan_discount_fee").hide();
} else {
$("#rbi_branch_pricing_concession").show();
$("#rbi_loan_discount_fee").show();
}
</script>
- See more at: community.progress.com/.../69630.aspx
No its not working @Charlton
Just wondering if I'm missing something in there
Can you please add a console log to print the value of UWStatus and its typeof before the if check as the jquery invocations seem fine?
Ok, Well firstly you had /* */ Around your code which comments it out, you may have missed this.
Maybe try some debugging.
<script>
var UWStatus = rbf_getPicklistCode("UW_Status");
if (UWStatus == "CTC - PTF|CTC" || "CTC - UTR|CTCUTR") {
$("#rbi_branch_pricing_concession").hide();
$("#rbi_loan_discount_fee").hide();
// check your console.
console.log("This is hiding");
} else {
$("#rbi_branch_pricing_concession").show();
$("#rbi_loan_discount_fee").show();
// check your console.
console.log("This is Showing");
}
</script>
- See more at: community.progress.com/.../69632.aspx
yes /**/ this comments I have placed it on purpose to post in here
Well that code doesn't seem to work or even the log is not posting anything on the screen
Well Its a view where it use to work on Confirm Status Change option...
Should we change the script to use ONLOAD or ONBLUR
Does anything log using this code?
var UWStatus = rbf_getPicklistCode("UW_Status");
console.log("Before IF");
if (UWStatus == "CTC - PTF|CTC" || "CTC - UTR|CTCUTR") {
$("#rbi_branch_pricing_concession").hide();
$("#rbi_loan_discount_fee").hide();
console.log("This is hiding");
} else {
$("#rbi_branch_pricing_concession").show();
$("#rbi_loan_discount_fee").show();
console.log("This is Showing");
}
console.log("After IF");
If not, do a check with onBlur="testFunction()"
function testFunction() {
console.log("Test function called!");
}
- See more at: community.progress.com/.../69637.aspx
Grrrrrr....
i'm sure I'm doing something really crazy it doesn't seem to work
I don't know how the first code was working before and now it doesn't anymore
I'm thinking loud.... if this code is it appropriate for this page / view or what ever we might call it
This page is a simple Confirm Status Change.....
UW Status - its a Reference fields from different Object
When user click on Workflow - Branch Pricing Concession
The workflow page shown below must hide 2 fields
The code is written under Design Page
here i don't even see a place even to write a script on onblur
Kindly guide me where am I going wrong
Try this: re-arrange your scripts and put it after the UW Status field.
Change the condition as:
if (UWStatus == "CTC" || "CTCUTR")
For a picklist item - CTC - PTF|CTC,
CTC-PTR is the label
CTC is the code.
Hence, you need to check the pickist code only against code values. That is
rbf_getPicklistCode("UW_Status") will either return:
CTC
or
CTCUTR
Correction
if (UWStatus == "CTC" || UWStatus == "CTCUTR")
Well I've tried that already... and also with new code I've tried shifting it after "UW Status" field .
Even placed the code under properties of the page ONBLUR / ON SUBMIT - NOTHING HAPPENS
so I'm trying the same code under the design section and also under properties hoping that works, but its a pure LET DOWN scenario
@msiraj
Well this is the latest code which I've updated and still see no results
integration name for UW Status is uw_status
<script>
var UWStatus = rbf_getPicklistCode("uw_status");
console.log("Before IF");
if (UWStatus == "CTC" || UWStatus == "CTCUTR") {
$("#rbi_branch_pricing_concession").hide();
$("#rbi_loan_discount_fee").hide();
console.log("This is hiding");
} else {
$("#rbi_branch_pricing_concession").show();
$("#rbi_loan_discount_fee").show();
console.log("This is Showing");
}
console.log("After IF");
}
</script>
Please follow the below instructions as is:
In Design the page, add custom script component after UW_Status field. You can drag and drop it there.
Edit Script Component and REPLACE code snippet with the following one, without any further modifications:
<script>
var debugMsg = function (msg) {
console ? console.log(msg) : alert(msg);
};
var UWStatus = rbf_getPicklistCode('uw_status');
debugMsg('UW Satus -' + UWStatus);
if (UWStatus == 'CTC' || UWStatus == 'CTCUTR') {
$('#rbi_branch_pricing_concession').hide();
$('#rbi_loan_discount_fee').hide();
debugMsg('This is hiding');
} else {
$('#rbi_branch_pricing_concession').show();
$('#rbi_loan_discount_fee').show();
debugMsg('This is Showing');
}
</script>
Next on Object Edit page, press f12 and look for console messages.
Please review the script below. In order to successfully hide/show a field you need hide and show both the "label" (L) and the "field" (F). This is how I hide/show when I want to include this functionality.
<script>
var debugMsg = function (msg) {
console ? console.log(msg) : alert(msg);
};
var UWStatus = rbf_getPicklistCode('uw_status');
debugMsg('UW Satus -' + UWStatus);
if (UWStatus == 'CTC' || UWStatus == 'CTCUTR') {
$('#rbi_F_branch_pricing_concession').hide();
$('#rbi_L_branch_pricing_concession').hide();
$('#rbi_F_loan_discount_fee').hide();
$('#rbi_L_loan_discount_fee').hide();
debugMsg('This is hiding');
} else if (UWStatus != 'CTC' || UWStatus != 'CTCUTR') {
$('#rbi_F_branch_pricing_concession').show();
$('#rbi_L_branch_pricing_concession').show();
$('#rbi_F_loan_discount_fee').show();
$('#rbi_L_loan_discount_fee').show();
debugMsg('This is Showing');
}
</script>
@msiraj - Well I did the same thing what ever you've mentioned step by step
Next on Object Edit page, press f12 and look for console messages. - well this part I'm not able to see which location are you mentioning
and the script seems not to function :(
On 'Status Change' page, it will be logging messages onto browser console. Browser console is not visible by default. To see it you will have to press F12 key.
Else, if you are still not able to see debug messages,
Change the first few stamtents in the code as:
var debugMsg = function (msg) {
alert(msg);
};
And then on your Status Change page, you will see alert boxes.
@msiraj - all i would see in the browser console is that
UW Satus -null
main.jsp:2864 This is Showing
Now that explains why the condition fails always.
rbf_getPicklistCode('uw_status'); is returning null.
Good part however is that you are configuring the script component correctly. It is executing on Status Change page.
Please carry out these Checks:
1. uw_status is the correct field integration name.
2. Field type for this field is either PicklistList or RadioButton.
3. In Field definition page, field values should be adefined as given below:
That is:
CTC - PTF|CTC
CTC - UTR|CTCUTR
4. The field is not marked as read-only on edit / status change page.
Regards,
Siraj.
On reviewing your earlier post, have noticed that field UW Status is marked as Read Only for status change page.
Thus, rbf_getPicklistCode returns NULL.
Siraj
well UW_status is a reference picklist field coming from other object.
and yes I've cross checked all of them
CTC - PTF|CTC
CTC - UTR|CTCUTR
so is there a way to pull the information based on the condition?
Is there a way to pass the way of Read Only field to some sort of hidden field whereby we can reference it?
Ok. There is a work around to make it work.
First, in UW Status field definition page, mark the field as editable on edit pages:
Second, in Status Change page script component::
Call rbf_getPicklistCode with integration name of picklist field in Related object.
That is, instead of rbf_getPicklistCode("UW_Status");
Modify it as rbf_getPicklistCode("{integration name of picklist field in Related object}");