• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Difficult Calculation code and PHP

Difficult Calculation code and PHP 11 years 5 months ago #25861

  • aegg
  • aegg's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
Hello,

could you please guide me with the following question/code:

The job is to build a special booking form. Version: Joomla 1.5.//RSForm Pro 44.

I read demo.rsjoomla.com/calculation-form-example and searched the forum, but cannot figure it out myself. I think I do not see/understand how to mix various fields and PHP together since I am not so well versed in coding. So I would much appreciate if you could help me out with the code. IF I once have the correct syntax I guess I am experienced enough to apply it in analogy.

General fields like Name, Address etc. are no problem. I could also address the fields with a simple calculation. The difficult part is to set-up the following calculation. I put the field names in [ ]. By name I mean the “Name” I can enter in the wizard. I am not sure if this is the ID.

The form has one default value [default] that increases with each submitted form based on total amount chosen. I build a hidden field for that. But at the same time I need to show the field since it is the default value for this particular user. --> Problem Nr. 1 I tried to build another field, to show the result but do not succeed in displaying the number.

The increment [increment] is fixed - another hidden field in the form I built.

Now the user can choose between options [options] - I set-up a radio button field with x items defining the choice. No problem here.

The calculation to be performed is to take the default value [default] * the amount (1,2,3 ..) of the field [options] + the [increment] when the [option] is >1. Here is an illustration:
current default value + 1* option = current default value
current default value + 2* option = current default value*2 + increment
current default value + 3* option = current default value*3 + increment*2
(...) basically a divergent series or a Gauss series If I recall school correctly.

-->Problem Nr. 2 - This I could not get to work at all I guess mostly since there is a mix of radio and text fields unlike the example where it is either/or.

Then I want to show the end amount – so I set-up another field for that. Since I do want to show the final amount prior to the submission I think I need to include the calculation in the [option] selection like onChose instead of onSubmitt. I could not get it to work.
--> Problem Nr. 3

Finally a user submits the form. As a result the next form should do exactly the same calculation but start with [default] from the last form. So I need to set a database query, but how?
--> Problem Nr. 4 --- I could not find an explanation in the forum (I checked: www.rsjoomla.com/forum/37-rsform-pro/219...bmissions.html#23804 and www.rsjoomla.com/forum/37-rsform-pro/222...se-fields.html#24231)

A practical example (not exactly the same) to explain the goal of the form better are booked seats starting from 0 and going up with each submission based on seats booked in each form (the increment factor is missing here).

Since it is a kind of urgent project I have no problem to pay/donate an extra support fee if needed. Just tell me how.
In case you are a 3rd party knowing how to implement this, just PM me.

Thank you very much for any help!
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!