Comparing 2 currency fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2014 08:38 AM
I have tried several ways to compare 2 currency fields and can't get it to work - this is what I currently have in place within a client script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return false;
}
if (parseInt(u_total_lc_cost.value) != (parseInt(u_total_cost.value) ))
{alert('ROM total and Lifecycle totals must equal'); }
return false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2014 01:19 PM
Hi there,
A few things are wrong there. The script will not know what "u_total_lc_cost is. You need to get the value.
var lc = g_form.getValue("u_total_lc_cost");
You need to do the same with the other variable as well. Once done, test that. If that still doesn't work, you need to use "parseFloat" and not "paeseInt" since currency is not an integer
If it's still not working, use alert() statement with the two values in to see what the values are showing as once converted to floats.
Pete