I have a lightning component which is a screen to check the timesheet entries of the employees. The supervisor can change the value of the timesheet(to fill gaps and stuff).

I have realised this by using a Lightning input type number. When a change happens in a row, I add this specific record to a list and this list is send to Apex to save when the user clicks the save-button.

When I click save, I logged the changed records and there everything is okay(for example 5.5), but when I debug in Apex, I see 55 as a value. So I don't understand why Apex transforms this in an Integer.

<lightning:input type="number" aura:id="field" step="any" name="{!emp.empId + ';' + day.dayId + ';' + entry.Id}" value="{!entry.Change_Supervisor__c}" variant = "label-hidden" onchange="{!c.handleEntryChange}"/>

Extra Information :

  • I use Salesforce objects to display everything etc
  • 1
    Provide handler method and apex code – devforce May 3 '19 at 9:35

For some reason the Lightning Input changed the number to text. I discovered this when using Stringify. So now I just use a foreach to check if the value is NaN. If so, I cast it to a Number. That was the solution. But in fact this shouldn't be a problem...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.