Skip to main content
10 events
when toggle format what by license comment
Nov 29, 2019 at 7:11 vote accept Cmd_Keen
Nov 28, 2019 at 15:32 answer added Charles T timeline score: 2
Nov 28, 2019 at 15:31 comment added Charles T I'll retype it in an answer :)
Nov 28, 2019 at 15:18 comment added Cmd_Keen yep, I played around a little bit more but looks like I actually needed to just typecast whatever is in the object (for-looped thru it) to a number with number() function. How can I mark this as the solution now? :)
Nov 28, 2019 at 12:52 comment added Charles T I think it's just because lightning:input is a universal component that can return many data types including strings and even arrays. So I've seen some weird casting artifacts happen. What I'd suggest is, before sending to Apex, use the JS Number() function to change the string decimals into proper numbers. Then Apex will receive it without ambiguity.
Nov 28, 2019 at 11:34 comment added Cmd_Keen Since in javascript the obj which is pushed to objs and which is passed to the component is set to the objecttype of this custom object objw.obj.sobjectType = 'customObjectForTargetField__c'; it is important to mention, that this quantity field is of data type 'number'. Is it possible that in such a case data types of currency are treaded as Strings in component attribute objects and data type number as an actual number ("1.8" vs 1.8)?
Nov 28, 2019 at 11:34 comment added Cmd_Keen Interessting is, that I have another input field in my iteration "Quantity" which looks exactly the same: <lightning:input type="number" name="quantityField" label="." variant="label-hidden" step="1" value="{!objs.obj.Quantity__c}" onchange="{!c.onChange}" min="1"/>. Difference in component is only the step attribute.
Nov 28, 2019 at 7:44 comment added Cmd_Keen Thanks for the quick response. Yes, it is actually stored as a String it looks like: e.g. {[...],"TargetFieldValue__c":"1.8",[...]}.
Nov 28, 2019 at 1:40 comment added Charles T Is JS passing Apex a string representation of the number, or treating it in JSON like a number? If it looks like {"myNumber":"1.8"} then yeah you're gonna have a problem. But if it looks like {"myNumber": 1.8} then you're good because dot is the correct way of writing a number in JSON. Maybe what you need to do is force the value to a number in JS before you call Apex. This could be a function of lightning:input treating numbers like strings.
Nov 27, 2019 at 22:22 history asked Cmd_Keen CC BY-SA 4.0