Hi, I am getting an error when redirecting to PayPal: "The link you have used to enter the PayPal system contains an incorrectly formatted item amount."
I have amount values through radio selection with the last one a custom amount the user can enter. I have tested the preset values (i.e. "50" or "100") and those work. When I put in "10" as a custom amount, I get the error.
This is the custom code I am using to update the value of the amount to pass to PayPal:
I tried to use the "number_format" line, but still getting the error.
Anyone know what I need to change to get this working? Thanks.
I have amount values through radio selection with the last one a custom amount the user can enter. I have tested the preset values (i.e. "50" or "100") and those work. When I put in "10" as a custom amount, I get the error.
This is the custom code I am using to update the value of the amount to pass to PayPal:
<?php
$input = JRequest::getVar('donation', '', 'post');
if ( $input == 'Other' ) {
$input = JRequest::getVar('other_amount', '', 'post');
}
JRequest::setVar('donation', $input);
?>
I tried to use the "number_format" line, but still getting the error.
<?php
$input = JRequest::getVar('donation', '', 'post');
if ( $input == 'Other' ) {
$input = JRequest::getVar('other_amount', '', 'post');
$input = number_format($input, 2, '.', '');
}
JRequest::setVar('donation', $input);
?>
Anyone know what I need to change to get this working? Thanks.
I figured it out.
I was able to get it working with this code:
I was able to get it working with this code:
<?php
if ($form->data["donation"] == "Other") {
$form->data["donation"] = $form->data["other_amount"];
}
?>
Hi kko,
You got it. ChronoForms only reads the JRequest data once - any changes after that have to be in the $form->data[''] array.
You can also do this by giving the 'other' input the same name as the drop down (and a different id) and hiding and disabling it unless 'other' is selected.
Bob
You got it. ChronoForms only reads the JRequest data once - any changes after that have to be in the $form->data[''] array.
You can also do this by giving the 'other' input the same name as the drop down (and a different id) and hiding and disabling it unless 'other' is selected.
Bob
This topic is locked and no more replies can be posted.