فتحات العرب Joomla! • Index page: Extensions for Joomla! 3.x • How to send value from two fields to Paypal

Tuesday, September 9, 2014

Extensions for Joomla! 3.x • How to send value from two fields to Paypal

I have a form built using Breezing Forms. The sole purpose of the form is to take donations and use Paypal to proces the donation.



In the form I have a radio button group with the name of "amount" with several dollar amount options t pick from. The last option in that radio group is "Other". If a user wants to enter a dollar amount other than the radio group options, then they select "Other" at which point a new field named "otheramount" opens to let the user type in a donation amount.



The Paypal button script is currently as seen below this message. The script and form work OK IF the user selects an amount from one of the radio group options and clicks the Paypal button. However, if the user selects "Other" from the radio group and then inputs another amount in the text field that appears, the value sent to the Paypal page is incorrect.



On line 5 of the script below I tried the following to add the "otheramount" field but when sent to Paypal the Donation amount shown is incorrect.



ff_getElementByName('PayPalSelect').value = 'Donation|0|' +

ff_getElementByName('otheramountamount').value +

ff_getElementByName('amount').value + '|0';





How in JS do I code it so that the value sent to Paypal is the "amount" field if the radio group is used OR the "otheramount" value if the text entry field is used?





Thanks D.



function ff_donate_action(element, action)

{

switch (action) {

case 'click':

ff_getElementByName('PayPalSelect').value = 'Donation|0|' +



ff_getElementByName('amount').value + '|0';

ff_validate_submit();

break;

default:;

} // switch

} // ff_donate_action

Statistics: Posted by Dougj — Tue Sep 09, 2014 1:46 pm








via Joomla! http://ift.tt/1onXi0W

No comments:

Post a Comment