function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sumit pawarsumit pawar 

how do i achieve below functionality using javascript?

i have two text boxes with number data type.
weight in lbs
weight in kgs

i want to convert from lbs to kgs and kgs to lbs...
when i will enter data in lbs its kgs value should display and kg textbox will get disable.
and same vice versa.

i used disabled in inputcheckbox but its not fuctioning correctly..
can u pls suggest me how to do this in javascript..?
Ramu_SFDCRamu_SFDC
Can you please post your code so that I can suggest the modifications.
sumit pawarsumit pawar
this is what i did but no luck..
function kToLbs(pK) {
    var nearExact = pK/0.45359237;
    var lbs = Math.floor(nearExact);
    return {
        pounds: lbs,
       
    };
}

var imperial = kToLbs(10);
alert("10 kg = " + imperial.pounds + " lbs");



function lbsToKg(imperial) {
    var pounds = imperial.pounds;
    return pounds * 0.45359237;
}

var kg = lbsToK({ pounds: 10, ounces: 8 });
alert("10 lbs  = + kg");

and my field names are:- data type(number)
formRec.Weight_lbs__c
formRec.Weight_in_kgs__c