[SOLVED] Format a field as currency

5 years 6 months ago - 4 years 9 months ago #307835 by ANIMEE
[SOLVED] Format a field as currency was created by ANIMEE
Hi all,

I need to format a field as currency (ex.: 100.000.000€) at least as display not so much as edit. How can I do it?

I put in the "Profile Value Layout" - [value]€ And the result is 100000000€ but there's any way to add the period (.)?

Thanks for the help

Please Log in to join the conversation.

5 years 6 months ago #307845 by krileon
Replied by krileon on topic Format a field as currency
We've no support for field masks (formatting for text inputs). You'll probably need to use a text field for the edit display then use a Code field using CB Code Field and custom PHP for the profile display to format it as a currency.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

5 years 6 days ago #311766 by ericmuc
Replied by ericmuc on topic Format a field as currency
Hello Krileon,
do you have a documentation please, how I can do this: "You'll probably need to use a text field for the edit display then use a Code field using CB Code Field and custom PHP for the profile display to format it as a currency."?
Thanks!

Please Log in to join the conversation.

5 years 6 days ago #311767 by krileon
Replied by krileon on topic Format a field as currency
No, we don't provide any sort of documentation for custom coding like that. Basically you'll be using 2 fields. 1 is the text field where they input whatever they want. The other is a code field provided by CB Code Field. In that code field you'd substitute in the value of the text field (e.g. [FIELD_NAME]) and run it though whatever PHP you like to format it however you like.

If you still want input masking, which is just JS, then you'll need to try and output your custom JS using CB Auto Actions on the before profile edit and before registration form display triggers (available in the dropdown when creating an auto action) using the Code action.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

4 years 9 months ago - 4 years 9 months ago #313208 by ericmuc
Replied by ericmuc on topic Format a field as currency
Hi,
first of all, great job and good service. But with this topic I am a little bit lost. I need many price fields and would like to make searches with price limits, so I need:
1) fields with i.e: 200,00 € (stored as 200.00 €)
2) search for profiles with fields value i.e. > 150,00 €
3) calculation with the values (i.e. field 1 - field 2)
I thought this can I manage with CB and the way you described in your reply is complicate (I need one field, in which the user makes the input and sees the output in the profile).
Hopefully there is a simplier way for 1)-3), which works with CB core fields?
Thanks, best regards
Eric

add:
ah, I found: www.joomlapolis.com/forum/153-professional-member-support/213707-solved-mathematical-calculation-fields?limitstart=0
so calculations can be make, 3),
Question: can be made also with string-fields ?

add:
question: can I use a string field and put in the validation for [*,**], so that the user can only put in currency format?

Please Log in to join the conversation.

4 years 9 months ago - 4 years 9 months ago #313212 by krileon
Replied by krileon on topic Format a field as currency
Integer fields can't handle decimals at this time. I've already a feature ticket to improve integer fields and rename them to Number fields so it can handle decimals. Best I can suggest for now if you need decimals is a text field and custom regexp validation rule to enforce it being a currency. Below is the forge ticket were I've noted some planned improvements; likely more will be added to the ticket.

forge.joomlapolis.com/issues/7620


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.228 seconds

Facebook Twitter LinkedIn