Forums

Small quirk, form not working

dem0072 05 Jun, 2012
So, I created an order form for a museum. And I got it working fine, ordering the on load and on submit events perfectly, hooked it up to authorize.net, it worked beautifully.

However, I tried creating another form for donations, and it was very similar to the first. I used some of the same fields. I order the same on load & on submit events, and it was again hooked up with authorize.net. Aside from the benign fields that differentiate the two, essentially the same form was created.

However, the new form throws an error on submission.
GreyHead 06 Jun, 2012
Hi dem0072,

Please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.

Note: if you are using the Easy Wizard you may need to switch to the Advanced Wizard to do this; if you want to continue to use the Easy Wizard please make a copy of your form first and add the Debugger action to the copy.

Bob
dem0072 06 Jun, 2012
Array
(
    [option] => com_chronoforms
    [chronoform] => Donate_10
    [event] => submit
    [Itemid] => 
    [donate_amt] => 10
    [input_radio_14] => Visa
    [input_text_18] => David
    [input_text_19] => M
    [input_text_20] => 1111 Main St
    [input_text_21] => Seattle
    [input_text_22] => WA
    [input_text_23] => 90000
    [input_text_15] => 4111111111111111
    [input_text_16] => 02
    [input_text_17] => 2013
    [input_text_24] => 123
    [input_submit_27] => Submit
    [69f734552491a35aeaa8fd6fef920334] => 1
    [_PLUGINS_] => Array
        (
            [authorize_net] => Array
                (
                    [response_code] => Error
                    [response_subcode] => 1
                    [response_reason_code] => 103
                    [response_reason_text] => This transaction cannot be accepted.
                    [approval_code] => NO VALUE RETURNED
                    [avs_result_code] => P
                    [transaction_id] => 0
                )

        )

)

Validation Errors
Array
(
)

Debug Data

    email
        23
            Result An email has been SENT successfully from (admin)admin@admin.com to david@example.com
            Body
            Donate $10
            Donation 	10
            Billing Information
            Payment Type 	Visa
            First Name 	David
            Last Name 	M
            Billing Address 	1111 Main St
            City 	Seattle
            State 	WA
            Zipcode 	90000
            Card Number 	4111111111111111
            Exp Month (mm) 	02
            Exp Year (yyyy) 	2013
            CVC/CV2 Code 	123


            Submitted by 67.183.xx.xx
            Attachments array ( )


Is that what you're looking for?
GreyHead 07 Jun, 2012
Hi dem0072,

The Authorize.net Notes for Response code 103 say "A valid fingerprint, Transaction Key, or password is required for this transaction."

Bob
dem0072 07 Jun, 2012
I have the authorize.net user ID and transaction key entered into the authorize.net plugin (which isn't in test mode), and I believe they are both correct (letter for letter what I was given, though I'll be double checking the transaction key in about an hour).

The on load only has load html under it. The on submit has send email, authorize.net (licensed) and the debugger you recommended.

Though it's still not doing anything with the transaction.

In authorize.net I made sure that the transaction key was required for orders and double checked that I had the right API user id. The order form has been SSL secured as well, and of course includes a submit button.

However it's still throwing the error code 103.
dem0072 08 Jun, 2012
Update:

I was able to get the error 103 to go away...

However now I have
 [authorize_net] => Array
                (
                    [response_code] => Error
                    [response_subcode] => 1
                    [response_reason_code] => 5
                    [response_reason_text] => A valid amount is required.
                    [approval_code] => NO VALUE RETURNED
                    [avs_result_code] => P
                    [transaction_id] => 0
                )


This code popping up. I've tried everything I can think of to change the format of the price. I was using 10.00=Donate $10, 10=10, 10.00=Donate 10.00. Nothing has worked, I've tried radio buttons, a selection list, hidden field. It just doesn't want to tell Authorize.net to charge a simple $10 amount.
GreyHead 08 Jun, 2012
Hi dem0072,

The explanation text for this error is "The value submitted in the amount field did not pass validation for a number."

The Authorize.net documents say:
[list]
  • x_amount

  • Required

  • The amount of the transaction

  • Up to 15 digits with a decimal point (no dollar symbol) Ex. 8.95

  • This is the total amount and must include tax, shipping, and any other charges. The amount can either be hard-coded or posted to a script.
  • [/list]
    Bob
    dem0072 13 Jun, 2012
    Ok thanks. We did get the form to work and complete transactions.

    I have another question though, one of the membership types for the forms will be auxiliary. So we're going to have people like seniors, students, military, etc registering at the rate of $30. However, I tried creating a variable for each of these -

    30.00=Student 30.00
    30.00=Senior 30.00
    30.00=Military 30.00

    And upon trying to save the form, it kicked out all by the last of the variables from the list. It only allowed me to save one.

    Do you know what needs to be done to have multiple variables with the same price, or a hack that could be employed to allow us to do this?
    GreyHead 13 Jun, 2012
    Hi dem0072,

    The values of the options - the part before the '=' have to be unique - otherwise there is not way to tell which one has been selected. Please try
    Student=Student 30.00
    Senior=Senior 30.00
    Military=Military 30.00

    This should give you a useful value in the form results.

    Bob
    dem0072 13 Jun, 2012
    I tried but it doesn't seem to work. It just gets an invalid amount error from authorize.net

    Do you have any other ideas or suggestions?

    If I understand correctly, everything to the left of "=" determines price (which is what authorize.net needs). Everything to the right is just a name. If this is the case and everything to the left of "=" must be unique, is it then impossible to have multiple memberships at the same price?
    GreyHead 14 Jun, 2012
    Hi dem0072,

    Sounds as though you need to add some custom code to set the amount - shouldn't be hard if it is always 30.

    Bob
    dem0072 16 Jun, 2012
    What would be the code and how would I go about adding it to one of the forms?
    GreyHead 18 Jun, 2012
    Hi dem0072,

    There's an example here

    Bob
    dem0072 28 Jun, 2012
    Hmm, doesn't seem to be working.
    Upon trying to input a custom element with that code I get the following php error:

    Parse error: syntax error, unexpected T_DNUMBER, expecting ')' in /home/museum/public_html/administrator/components/com_chronoforms/form_actions/show_html/cfaction_show_html.php(124) : eval()'d code on line 57


    The code I'm trying to use is:

    <?php
    $banner_price_list = array(
      Individual 50.00 => 50.00,
      Family 75.00 => 75.00,
      Smithsonian Sustainer 150.00 => 150.00,
      Contributor 250.00 => 250.00,
      Patron 500.00 => 500.00,
      1892 Club 1000.00 => 1000.00,
      Senior 30.00 => 30.00,
      Military 30.00 => 30.00,
      Educator 30.00 => 30.00,
      Artist 30.00 => 30.00,
      Dual Senior 60.00 => 60.00
    );
    $form->data['banner_price'] = $banner_price_list[$form->data['banner']];
    ?>


    Is there any significant problems with it that you can see?
    GreyHead 28 Jun, 2012
    Hi dem0072.

    That looks OK but I suspect that the problem isn't there. Do you have some custom code in the Form HTML?

    Bob
    dem0072 28 Jun, 2012
    Under the preview tab there's some headers to help organize the layout of the form, but nothing other than simple text formatting. I don't see anywhere on the onload show html (under events) action to do any custom html.

    I've tried naming the fields on the custom element to reflect "banner_price_list" as its referenced on the PHP script. Additionally I pointed authorize.net to the new label and when I try to visit the form it only displays and error (it won't load the form after trying the custom element).

    The error is now
    Parse error: syntax error, unexpected T_DNUMBER, expecting ')' in /home/museum/public_html/administrator/components/com_chronoforms/form_actions/show_html/cfaction_show_html.php(124) : eval()'d code on line 20


    To clarify, I'm using a "custom element" on the preview tab, not "custom code" on actions. Is this correct?
    GreyHead 29 Jun, 2012
    Hi dem0072,

    Hmm you have the same error but the line number is 20 instead of 57 so something has changed.

    Ah I think I see the problem, you need quotes round the strings here (I missed that yesterday).
    $banner_price_list = array(
      'Individual 50.00' => 50.00,
      'Family 75.00' => 75.00,
      'Smithsonian Sustainer 150.00' => 150.00,
      'Contributor 250.00' => 250.00,
      'Patron 500.00' => 500.00,
      '1892 Club 1000.00' => 1000.00,
      'Senior 30.00' => 30.00,
      'Military 30.00' => 30.00,
      'Educator 30.00' => 30.00,
      'Artist 30.00' => 30.00,
      'Dual Senior 60.00' => 60.00
    );
    $form->data['banner_price'] = $banner_price_list[$form->data['banner']];
    ?>

    Bob
    dem0072 29 Jun, 2012
    Ok, well the error is gone now (so I count that the code is validated) however the dropdown field isn't showing up. Its just spitting out code in plain text on the form.

    I noticed there was no php tag on the front so I added one and the code just disappeared on the page. Should this be inclued?
    <?php>


    Or should it just start with
    $banner_price_list = array(


    And this is supposed to be used in a custom element right? Is there anything else required to make a drop down form field appear?

    Thank you for the in-depth support & patience🙂
    GreyHead 30 Jun, 2012
    Hi dem0072,

    I only copied the array part - you still need the PHP tags and the code after the array.

    Bob
    dem0072 02 Jul, 2012
    Ok, so should I be putting that PHP code into a custom code action under events then? If so do I just keep the normal dropdown for the actual form, or do I have to custom code a dropdown of my own?
    dem0072 07 Jul, 2012
    I'm unsure of where to put the PHP code for the custom variables in relation to what I need to do to have a dropdown show up that pulls information from them. Can you clarify?
    GreyHead 08 Jul, 2012
    Hi dem0072,

    I'm confused. I though you already had the drop-down working and this code was intended to look up the price once the form was submitted?

    Code to look up the price will go into a Custom Code action in the On Submit event.

    Bob
    This topic is locked and no more replies can be posted.