want the value of checkboxes to be changed in the summarize

  • michiel@TSS
  • Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 94
  • Thank you received: 0

michiel@TSS created the topic: want the value of checkboxes to be changed in the summarize

Hello,

We have made some checkboxes with value which are calculating properly to the total field. However in the summurize we get now the label and the value if the checkbox is checked. We want in the summarize that only a yes is shown. So the visitor only sees that he has checked that box..
How can we do this?

I hope these screenshots will help to understand what i want.

Thanks
#236736
Attachments:
  • Posts: 2553
  • Karma: 87
  • Thank you received: 343

mihaela replied the topic: want the value of checkboxes to be changed in the summarize

Hello,

What you want to achieve can't be easily done.

The reason is that you can either set "Yes" as a value that gets saved to a specific checkbox or the number that you use in calculations, you can't have both.

There is a solution for this, but it would require some coding.

What you could do is you could set "yes" to be the checkbox value. Then in the calculations, you couldn't simply add values of the checkboxes, but you would have to add conditions to the code similar to presented in this example crosstec.org/en/support/online-documenta...g-checkbox-sums.html .

In your case, you would have conditions like:
 if (ff_getElementByName('zoekfunctie').checked)
     {
          ff_getElementByName('total').value = 
          Number(ff_getElementByName('total').value) + 25;
     }
In this piece of code I've assumed that name of the checkbox is "zoekfunctie" and name of the sum field "total".

Let me know whether this is working for you.

Regards,

Mihaela
#236745
  • michiel@TSS
  • Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 94
  • Thank you received: 0

michiel@TSS replied the topic: want the value of checkboxes to be changed in the summarize

Hello,

I have been trying what you suggested for the calculation.. and implemented this:
{
ff_getElementByName('Totaal_website').value =
Number(ff_getElementByName('Totaal_website').value) + Number(ff_getElementByName('Zoekfunctie').value) + 25;
}

To get the value of calculated in the total and in the summary the Yes (Ja)
But in the total i now get a NaN see screenshot ..

I think it is not the correct way can you help please?
Thanks
#236767
Attachments:
  • michiel@TSS
  • Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 94
  • Thank you received: 0

michiel@TSS replied the topic: want the value of checkboxes to be changed in the summarize

Hello,
I have replied earlier on this topic .. i get a Ja (yes) in the summary but in the end calculation it shows a NaN so something is going wrong there. Also gave you some screenshots.. But i can not see my reply. Did you receive it or do i need to sent it again?
#236774
  • Posts: 2553
  • Karma: 87
  • Thank you received: 343

mihaela replied the topic: want the value of checkboxes to be changed in the summarize

Hello,

I did receive the screenshots. Forum posts don't become visible until we review them. Therefore when you write a post it is not visible right away.

I think I see why this is not working.
What I think is wrong in this code:
{
ff_getElementByName('Totaal_website').value =
Number(ff_getElementByName('Totaal_website').value) + Number(ff_getElementByName('Zoekfunctie').value) + 25;
}
is adding "Number(ff_getElementByName('Zoekfunctie').value)". If the field "Zoekfunctie" has value "Ja" then you are using a string in calculation, in other words you are adding letters and numbers and therefore the result is NaN(not a number).

If I've understood correctly how your fields look like, the piece of code should look like this:
if (ff_getElementByName('Zoekfunctie').checked)
     {
          ff_getElementByName('Totaal_website').value = 
          Number(ff_getElementByName('Totaal_website').value) + 25;
     }

Let me know whether this resolves the issue.

Regards,

Mihaela
#236828
  • michiel@TSS
  • Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 94
  • Thank you received: 0

michiel@TSS replied the topic: want the value of checkboxes to be changed in the summarize

Hi,
Sorry for my late answer, but this has resolved the issue.
Many thanks
#236927
Moderators: ForumSupporttomeperica
Time to create page: 0.606 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

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!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here