• 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: calculate fields

calculate fields 17 years 2 months ago #2156

  • paradoes
  • paradoes's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
Hi, I have used this script from the form

if(isset($_POST)){
$_POST = ($_POST * $_POST) + $_POST;
}

and changed into my position. Field 3 is a hidden field called: totaal
field 2 and field 1 called: 5euro with value 5 and 6euro with value 6 and are also hidden fields. n is kind28 and volw28 which are selectbox fields 1 to 9
Here is my script;

if(isset($_POST)){
$_POST = ($_POST * $_POST) + ($_POST * $_POST);
}

In my thank you mail I placed {totaal} but het mail shows no totaal of the script.:(
What is wrong, can anybody help me?

Gr Rini
The administrator has disabled public write access.

Re:calculate fields 17 years 2 months ago #2204

  • roed
  • roed's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
I have tried this script too and get the same error, or the same blank field in my thank you mail. I have asked for help on calculating fields for a long time but nobody seems to know how it works?!?!

If you figure out a solution please post it here :-)

/Michael
The administrator has disabled public write access.

Re:calculate fields 17 years 2 months ago #2210

  • sebyp
  • sebyp's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 18
The script looks fine to me. In order to try and find a solution, please consider:
1) Turn on error_repoting with the E_ALL option (in case you haven't done that already)
2) \"force\" php to see the submitted values as numbers (i.e integers, floats) using a cast.

Please keep us posted
The administrator has disabled public write access.

Re:calculate fields 17 years 2 months ago #2287

  • roed
  • roed's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
Thanks for the feedback. Just to be certain are these settings something that has to be set on the server or in RSform setup?

Thank you.
The administrator has disabled public write access.

Re:calculate fields 17 years 1 month ago #2525

Hi,

I'm seeing the exact same problem. I set \"Error Reporting\" to Maximum in the Joomla Global Configuration and no errors were displayed when the form was displayed or when the user clicked on submit.

To simplify the code even further, instead of a calculation, I decided to simply set the value of a hidden field to a constant. Thus, I created a form and named it \"MyForm\". It has a hidden field named \"MyNumber\" whose default value is empty.

In the Thank you and Emails tabs, I have:
MyNumber = {MyNumber}.

In the \"Script called on form process\", I have:
echo \"Start of Script called on form process.\";
if(isset($_POST['MyForm']['MyNumber']))
{
	$_POST['MyForm']['MyNumber'] = 999;
	echo $_POST['MyForm']['MyNumber'];
}
else
{
	echo \"MyNumber hasn't been set.\";
}
echo \"End of Script called on form process\";

Results:
When the form is displayed, it starts with:
Start of Script called on form display.
MyNumber hasn't been set.
End of Script called on form display.

The above is followed by my form fields.

When I click on \"Submit\", the current form clears and a Thank you message appears saying:
My Number = .
The email also has a \"blank\" value for \"My Number\".

If I change the default value of the hidden variable (i.e. MyNumber) to 1 for example, the Thank you and Email sent display that default value Instead of the value I set on the script:
My Number = 1.

Any idea on how to change the value of \"MyNumber\" through a script?

I have Joomla 1.0.15, RSForm 1.0.4, PHP 5.2.5.

Thanks!

Carlos

Post edited by: carlosleon0615, at: 2008/03/25 14:21<br><br>Post edited by: carlosleon0615, at: 2008/03/25 14:23
The administrator has disabled public write access.

&lt;SOLUTION&gt; Re:calculate fields 17 years 1 month ago #2591

Hi everyone,

I wanted to share with you the solution Alexandru provided for me! :laugh:

Form Name: MyForm
1st Field Name: InputNumber Type: Text
2nd Field Name: MyResult Type: Hidden

On the \"Thank You\" and \"Email\" tabs I have:
The result is: {MyResult}.

I have the following script on \"Script called on Form Process\":
if(isset($_POST['form']['InputNumber']))
{  
	$processform['MyResult'] = intval($processform['InputNumber']) * 3.5 + 10;
}

Note that even if my form is called \"MyForm\", the $_POST in the if statement is NOT using that name but instead it simply uses \"form\":
if(isset($_POSTform[/b]']))

Since the above code works, I assume we should ALWAYS use 'form' and NOT the actual name of the form.

I hope this helps anyone out there trying to do some calculations!

Thanks a lot for your help Alex!!

Regards,

Carlos
The administrator has disabled public write access.

Re:&lt;SOLUTION&gt; Re:calculate fields 17 years 1 month ago #2642

  • roed
  • roed's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
Thank you so much for your post carlosleon0615 but I still can't get no number in the result. Not even if I don't calculate any numbers but only want to \"transfer\" a value from another field to the result field.
if(isset($_POST['form']['test']))
{  
    $processform['total'] = intval($processform['test']);
}

The result stays blank.

Maybe this is a server problem not fulfilling all the needs for RSform to work??? Dunno but I have giving up know on this :(
I hope that this has been simplified in the next version of RSform and that will make it work for me.
The administrator has disabled public write access.

Re:calculate fields 17 years 1 week ago #2839

  • sue
  • sue's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
:blink: I have tried the suggestions(in all three forum areas) for creating the calculate field. Nothing seems to work. Do the suggestions in this thread work with Joomla1.5
The administrator has disabled public write access.

Re:calculate fields 16 years 9 months ago #3769

Anyone have any luck with this example, cant get it to work in 1.5
Colorado Fastpitch Softball
http://www.softballnews.net
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!