Page 1 of 1

How can I set a value in a select-menu to "0.001"?

Posted: Thu Jul 03, 2014 1:59 pm
by Nicklas

Is it possible to set a value in a "select" to a decimal, for example 0,001. I've tried with 0.001, 1E-03 and 0,001? How can I do that?


How can I set a value in a select-menu to "0.001"?

Posted: Thu Jul 03, 2014 2:44 pm
by Kateryna Grynko

Hi Nicklas,

Yes, do you have any problem with it?


How can I set a value in a select-menu to "0.001"?

Posted: Thu Jul 03, 2014 3:05 pm
by Nicklas

Hi Katya!
Yes, when I do it, it just use the number before comma, in this case 0.
Should it work like the way I set the value?


How can I set a value in a select-menu to "0.001"?

Posted: Thu Jul 03, 2014 3:25 pm
by Kateryna Grynko

Nicklas,

Did you try using a dot instead of a comma?


How can I set a value in a select-menu to "0.001"?

Posted: Thu Jul 03, 2014 3:31 pm
by Nicklas

Yes. I've tried: 0,001 and 0.001 but it still comma cant be used and when I use dot, it just using the first number (in this case is 0, not 0.001)


How can I set a value in a select-menu to "0.001"?

Posted: Thu Jul 03, 2014 6:45 pm
by Kateryna Grynko

Nicklas,

I'm not able to reproduce the issue. Could you please post a screenshot of that '0' and the exact steps you follow to reproduce the behaviour? Any string can be a value in Select component.


How can I set a value in a select-menu to "0.001"?

Posted: Thu Jul 03, 2014 6:48 pm
by Nicklas

Sorry but I forgot to tell you that Im trying to use the value in JavaScript with math. So when I tried to for example 20,001, the answer is 0, not 0,002. But when I changing the value to for example 6 (26) then the answer is 12.


How can I set a value in a select-menu to "0.001"?

Posted: Thu Jul 03, 2014 7:38 pm
by Nicklas

This is my script if it helps.
Number1 and number2 is a "Input" and select1 is a "Select". In the select I have to options: The first has value: 1 and the second has value: 0.001.

Script:

var one, two, three;

one = parseInt(Appery("number1".val());
two = parseInt(Appery("number2).val());
three = parseInt(Appery("select1).val());

alert(one(twothree));


How can I set a value in a select-menu to "0.001"?

Posted: Thu Jul 03, 2014 9:05 pm
by Kateryna Grynko

Hi Nicklas,

Instead of parseInt() use parseFloat() - it converts a string to a number with floating point rather than integer.


How can I set a value in a select-menu to "0.001"?

Posted: Thu Jul 03, 2014 9:55 pm
by Nicklas

YEAH!
Great!!! Thank you very much!