- 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 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 09:36 AM
Thank you Abhinay for the reply.
We tried this one in client script. But script is not working if we, change field value. It's working on form load.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2017 10:10 AM
Keep in mind that parseFloat will not work properly for localized instances
For example in Germany
- "," is used as decimal seperator
- and "." is used as thousand seperator.
Now lets have this example field
- Field "cost" has set EUR 10.000,50
Here
- g_form.getValue("cost") will return EUR;20.000,50
- parseInt(g_form.getValue("cost_field").split(";")[1] < 10000 would now be true because parse "COST" is interpreted as 20 Euros instead of 20000 Euros and 50 Cents
However you can use g_form.getIntValue to get the Integer At least it seems like this Method is already taking care of the decimal / thousand session seperator. At least I tested getIntValue on 20.000 was in fact returning 20000 on my localiszed instance. But this method has another withdraw, as it will always cut the cents

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2016 09:36 AM
Where did you place this script? Can you post the script you are using?