TOPIC:

format number-values - saved with dot and not with comma 5 months 1 week ago #257337

  • Topic Author
  • Mister.Miracle
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 136
  • Karma: 1
  • Thanks: 1
Hi,

i want to create a form, so that the user can see, how much values he has entered.

So i can create a form, where is only the name and the sum of all entered values / numbers of colum.

I have to check alle rows - related to user xyz - and have to sum all entered values.
this i would enter into a form field (readable) with the calculated values / sum.

Now i looked for the exported values by csv-format.
I imported it to excel... but in Germany there is written a number 1,5 or 2,25 instead of 1.5 and 2.25.
Now.... Excel is not able to calculate by excel....
but if i can create the form... i dont have to user Excel.

Thank you.

Please Log in or Create an account to join the conversation.

format number-values - saved with dot and not with comma 5 months 1 week ago #257347

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 6916
  • Karma: 3
  • Thanks: 492
Hi,

I create an example for you with German number.

File Attachment:

File Name: testform134.zip
File Size:7 KB

Pleasee download->unzip and install it (BF->Configuration->Package Installer)

I added two textfields with name number1 and number 2, and textfield for sum with name sum

In action script of sum I added the code (check Custom, check Change):
function ff_sum_action(element, action)
{
var number1 = ff_getElementByName('number1').value.replace(/\./g, ',').replace(/\,/g, '.');
var number2 = ff_getElementByName('number2').value.replace(/\./g, ',').replace(/\,/g, '.');
var n1=Number(number1);
var n2=Number(number2); 
ff_getElementByName('number1').value = n1.toLocaleString('de-DE');
ff_getElementByName('number2').value = n2.toLocaleString('de-DE');

var suma=n1+n2;

// output sum
ff_getElementByName('sum').value = suma.toLocaleString('de-DE', {
    minimumFractionDigits: 2,
    maximumFractionDigits: 2
});
} // ff_sum_action
Then in each textfields (number1 and number2) I called those function for suma.

The code in number1 actionscript look like:
function ff_number1_action(element, action)
{
   ff_sum_action(element, action);
} // ff_number1_action
and in number2 :
function ff_number2_action(element, action)
{
   ff_sum_action(element, action);
} // ff_number2_action
Attachments:

Please Log in or Create an account to join the conversation.

format number-values - saved with dot and not with comma 5 months 2 days ago #257674

  • Topic Author
  • Mister.Miracle
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 136
  • Karma: 1
  • Thanks: 1
okay i think i understand.

you got the number value by the form and changed the dot to comma...
and added it to the other sum.

could i include a extra text / numbers field / element where i could sum every entered values, so the user could see, how much money or something else has entere before.

the idea:
i have a user-budget of hours, he could spent on something. And he send the spending time to the form...
after 5 entered values... the user dont know how much hours he has spent to the project.

Now i could show the sum of the hours entered before to the user, so he has the information at all.

i think about something like this...
select ENTEREDVALUES_HOURS WHERE USERID=USERID_ACTIVUSER AND ENTEREDDATE BETWEEN 01.01.ACTIVEYEAR AND 31.12.ACTIVEYEAR

SUM(EVERY_ENTERED_NUMBERS

I hope you understand what i mean :-)

Thank you.

Please Log in or Create an account to join the conversation.

format number-values - saved with dot and not with comma 5 months 1 day ago #257682

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 6916
  • Karma: 3
  • Thanks: 492
Hi,

could i include a extra text / numbers field / element where i could sum every entered values, so the user could see, how much money or something else has entere before.

you can make a special fields for each element/fields and calculate how much he entered in ?
select ENTEREDVALUES_HOURS WHERE USERID=USERID_ACTIVUSER AND ENTEREDDATE BETWEEN 01.01.ACTIVEYEAR AND 31.12.ACTIVEYEAR

SUM(EVERY_ENTERED_NUMBERS
I will try to test this, but for this you need to backup data from database

Regards,
Tihana

Please Log in or Create an account to join the conversation.

format number-values - saved with dot and not with comma 4 months 3 weeks ago #258084

  • Topic Author
  • Mister.Miracle
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 136
  • Karma: 1
  • Thanks: 1
Hi, i tried it... and got a very long SQL-Statement, that work :-)

Now... how can i display the result of the SQL-Statement into a breezing-form field (text).
I tried it, but dont work.
Maybe you could explain...

1.) How to insert the result to a field
2.) how to work with this sql-result by transmittion-script - for example to create an email with this value.

Thank you

Please Log in or Create an account to join the conversation.

format number-values - saved with dot and not with comma 4 months 3 weeks ago #258095

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 6916
  • Karma: 3
  • Thanks: 492
Hi,

you should to load result from the query, and then populate field with the value.

Here is a small example:
this->execPieceByName('ff_InitLib'); //Include BreezingForms Library
$db = JFactory::getDBO();//Get Database Object
$user = &JFactory::getUser();//Get user Object
 
//Create your own query 
$db->setQuery('Select name From #__users Where id='.$user->id); 
 
$result = $db->loadResult(); //load the result from the query
ff_setValue('ElementName', $result); // populate the value in the form. Change ElementName to the real name of your element
P.S: the code should be in Before form pieces

Let me know if you need more help

Regards,
Tihana

Please Log in or Create an account to join the conversation.

Last edit: Post by tihana.krivic.
  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.051 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!