1. lutsmi
  2. Features Request
  3. Monday, September 08 2014, 04:30 PM
Hello, i created fields with numeric funktion and use your skeleton plugin to add and show the summary in another field...
how can i use decimal worth example: instead of 10 use 10,75 or 10,22 ... if i enter 10,22 it shows 10 ...i need 2 numbers behind the decimal point.
Thanks a lot
admin Accepted Answer
Admin
Hi,
numeric field respect html5 numeric validation, so accept only integer.

To do this you can use text type instead numeric type.

To accept only decimal values you can set these parameter under "Options Text Field" tab:
- Format -> Custom
- Custom Format -> \d*\,?\d*

"\d*\,?\d*" this is regex expression for decimal value
  1. more than a month ago
  2. Features Request
  3. # 1
lutsmi Accepted Answer
Thanks, but with a textfield the skeleton calculation does not work ...
maybe theres another solution
  1. more than a month ago
  2. Features Request
  3. # 2
admin Accepted Answer
Admin
Hi,
yes because PHP accept number like 10.5 not 10,5

replace this
$data['field3']=$data['field1']+$data['field2'];

with this
$var1=str_replace(',','.',$data['field1']);
$var2=str_replace(',','.',$data['field2']);
$var3=$var1+$var2
$data['field3']=str_replace('.',',',$var3);


$var1 contain the string of field1 field with . instead ,
$var2 contain the string of field2 field with . instead ,
$var3 contain the sum
in field3 put the $var3 with , instead .
  1. more than a month ago
  2. Features Request
  3. # 3
lutsmi Accepted Answer
Hello an thanks,

i tried to make the modification...but it doesn´t work ..
Can you please modifie the attached file for me?
THX again
References
  1. http://diet.conweb24.de
  1. more than a month ago
  2. Features Request
  3. # 4
admin Accepted Answer
Admin
Hi,
sorry for late reply, we had some problems with our server. Today we will send you the code ;)
  1. more than a month ago
  2. Features Request
  3. # 5
lutsmi Accepted Answer
No Problem ... thanks
  1. more than a month ago
  2. Features Request
  3. # 6
admin Accepted Answer
Admin
Hi,
can you provide me another account for your site? now the old account is blocked. ;)
  1. more than a month ago
  2. Features Request
  3. # 7
lutsmi Accepted Answer
User is unblocked ... :-)
THX
  1. more than a month ago
  2. Features Request
  3. # 8
admin Accepted Answer
Admin
Hi,
I have inserted this code at file /plugins/jsn/skeleton/skeleton.php and works:
$text1=str_replace(',','.',$data['text1']); // replace , with . to get PHP valid decimal
$text_result=($text1-100)*(0.85); // operation
$data['textresult']=str_replace('.',',',$text_result); // replace . with , to have human readable decimal


now when you fill the text1 field you can have the result of operation into textresult field
  1. more than a month ago
  2. Features Request
  3. # 9
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.
Sorry, the discussion is currently locked. You will not be able to post a reply at the moment.