CalcBuilder Forum

Bond calculator

User Moegamat Alexander 2025-08-31 14:33:43

Hi we have tried applying every variable after studying your Amortisation Caclulator as a sample to get a Bond calculator to work we have even resorted to Gemini Ai for assistance with no success.
Please can you have a look and see what we are doing incorrectly as we just cannot get it to work.

User Moegamat Alexander 2025-08-31 14:36:12

The calculators can be found under the Resources menu

Moonsoft support 2025-09-01 09:19:48

Hi,
tried to access the site but it seems down at the moment, can you please update the ticket as soon as its ready for us to check? Also it would help if you could explain with more detail the problem that you have with your calculator.
Thanks ,regards
Silvia Martín
Moonsoft Team

User Moegamat Alexander 2025-09-02 17:15:36

my apologies I gave you an incorrect URL

Moonsoft support 2025-09-03 09:07:03

Hi,
we've checked one of the calculators at your backend (bond calculator 3), and although most of the configuration is correct, you have some problems at the php code section, probably because you've generated it as if it was a separated code on an isolated page, so there are some minor adjustments to make, as follows:

- remove the enclosing php tags, you're already executing php code at this section (remove first and last lines/ lines 1 and 59)
- remove the section where you initialize all the inputs and then try to recover them from the post (this step is already provided by the extension).
Lines 18,19,20,21,28,29,30,31
- (optional). you can remove the form field 'payment', as this is an output, it can just be calculated and then printed at the output without any configuration.
- and finally, you may want to print ##error## before the calculated results, just in case some of the validations you make at the code fails and want to show the user the information.

and then you should see your calculations results, please let us know if you need further help

Best regards
Silvia Martín
Moonsoft Team

User Moegamat Alexander 2025-09-15 14:55:53

Hi Thank you for the feedback I have applied all your suggestions except ##error## As I have no idea what that is and how to do it.
But the calculator is still failing with this error:
INCORRECT_VALUES

Moonsoft support 2025-09-16 09:43:33

Hi,
rechecked the calculator and found you have not removed the section where you try to recover values from the request. This is not correct as the extension already does this step for you, you only need to start with the calculations at the code section. If you remove these lines:

// Sanitize and validate the input values.
$saleprice = filter_input(INPUT_POST, 'saleprice', FILTER_VALIDATE_FLOAT);
$interestrate = filter_input(INPUT_POST, 'interestrate', FILTER_VALIDATE_FLOAT);
$period = filter_input(INPUT_POST, 'period', FILTER_VALIDATE_INT);
$paymentsperperiod = filter_input(INPUT_POST, 'paymentsperperiod', FILTER_VALIDATE_INT);

you will see the output showing.

The alert INCORRECT_VALUES shows when any of the validations fail before sending data. For ex, you have the field 'period' configured as required. If you try to send the form without typing any value there, you will get the warning. Please note you have placed at that field a placeholder, that is only a hint for the user, not a real value. If you want to show any value by default you need to enter it at the the 'default' configuration field.

We have applied these 2 changes to the bond calculator 3 and now it shows the output as expected.

Best regards
Silvia Martín
Moonsoft Team

...
Support/development 40 hours

With the peace of mind of having a professional team at your service (20% discount)

Buy now!
...
List Manager

Build different lists for your site

Buy now!