- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2016 09:19 AM
Hi Friends,
We have a requirement, where we need to hide/visible a field based on a amount field(Field type is currency). For example, if the amount is less than 10K, fields need to visible, otherwise field should not visible.
For this we tried to do using UI policy and Client script. But during the form Load , it's working fine. But it's not working , during field value Change.
Please provide your inputs.
Thanks.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2016 09:27 AM
Use this script
if(parseFloat(newValue.split(';')[1])<10000){
g_form.setDisplay('field_name',true);
}
else{
g_form.setDisplay('field_name',false);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2016 12:54 PM
Hi Abhinay,
I used the below script in Onchange client script.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
alert(" Alert1");
if (isLoading || newValue === '') {
return;
}
var amt = g_form.getValue('amount');
var currParts = amt.split(";");
if (currParts.length > 0) {
amt = parseFloat(currParts[1]);
if (amt > 6) {
//make fields hide and show here
alert("alert 2");
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2016 01:01 PM
Is it working now? what are you seeing? Put alert to see the amt value too
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2016 01:24 PM
I put the alerts. alerts are showing only during loading the page, Not showing during the filed value change.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
var amt = g_form.getValue(amount);
g_form.addInfoMessage(amt);
if(parseFloat(amt.split(';')[1]) < 10000){
alert("value changes 2");
alert(amt);
// }
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2016 01:26 PM
Here you missed the if block
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var amt = g_form.getValue(amount);
g_form.addInfoMessage(amt);
if(parseFloat(amt.split(';')[1]) < 10000){
alert("value changes 2");
alert(amt);
// }
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2016 01:32 PM
Hi Abhinay,
I removed those lines for testing purpose. If I keep those lines, not displaying any alerts even during the form load .
Thanks.