Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - Number Format in field
  FAQ FAQ  Forum Search   Register Register  Login Login


Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

Number Format in field

 Post Reply Post Reply
Author
Robert1977 View Drop Down
New Member
New Member


Joined: 05 Mar 2015
Location: Polska
Points: 15
Post Options Post Options   Quote Robert1977 Quote  Post ReplyReply Direct Link To This Post Topic: Number Format in field
    Posted: 18 Oct 2018 at 7:12am
Hi,
A would like to set this kind of format in number field: 
1 221,00  
1 546 684,54
154 879 884,00 etc.

I know one way:

event.value = util.printf("%,2.2f",event.value).toString().replace(/\./gim," ");

BUT if field is empty, it shows "0,00". I don't want to see "0,00" in empty fields, but just nothing. Could anybody help ?

Robert
Back to Top
Sponsored Links


Back to Top
BAlheit View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Points: 1110
Post Options Post Options   Quote BAlheit Quote  Post ReplyReply Direct Link To This Post Posted: 18 Oct 2018 at 8:36am
Use something like this:

if (event.value != "") {
  if (event.value == 0)
    event.value = "";
  else
    event.value = util.printf("%,2.2f",event.value).toString().replace(/\./gim," ");
}
Back to Top
Robert1977 View Drop Down
New Member
New Member


Joined: 05 Mar 2015
Location: Polska
Points: 15
Post Options Post Options   Quote Robert1977 Quote  Post ReplyReply Direct Link To This Post Posted: 18 Oct 2018 at 7:12pm
THANK YOU VERY MUCH  !!! Handshake Thumbs Up
Back to Top
Robert1977 View Drop Down
New Member
New Member


Joined: 05 Mar 2015
Location: Polska
Points: 15
Post Options Post Options   Quote Robert1977 Quote  Post ReplyReply Direct Link To This Post Posted: 14 Dec 2018 at 11:57am
BAlheit View Drop Down 
Could you tell me how to change this format so that only integer accepted ?
Back to Top
Robert1977 View Drop Down
New Member
New Member


Joined: 05 Mar 2015
Location: Polska
Points: 15
Post Options Post Options   Quote Robert1977 Quote  Post ReplyReply Direct Link To This Post Posted: 14 Dec 2018 at 11:59am
Could you tell me how to change this format so that only integer accepted ?

if (event.value != "") {
  if (event.value == 0)
    event.value = "";
  else
    event.value = util.printf("%,2.2f",event.value).toString().replace(/\./gim," ");
}
Back to Top
gkaiseril View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Location: USA
Points: 4106
Post Options Post Options   Quote gkaiseril Quote  Post ReplyReply Direct Link To This Post Posted: 14 Dec 2018 at 7:24pm
You can use the validation tab to create a custom validation to see if an integer value was entered by the user. Also you could change the number of decimals to in the util.printf command  to 0.
Back to Top
Robert1977 View Drop Down
New Member
New Member


Joined: 05 Mar 2015
Location: Polska
Points: 15
Post Options Post Options   Quote Robert1977 Quote  Post ReplyReply Direct Link To This Post Posted: 24 Dec 2018 at 11:10pm
gkaiseril, thank you very muchj for your answer, but could you change this format  ???

if (event.value != "") {
  if (event.value == 0)
    event.value = "";
  else
    event.value = util.printf("%,2.2f",event.value).toString().replace(/\./gim," ");
}

If I change one line :
    event.value = util.printf("%,2.0f",event.value).toString().replace(/\./gim," ");
then if i enter a number with a comma, then I will get "1" :)


Edited by Robert1977 - 24 Dec 2018 at 11:14pm
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.031 seconds.