Donation API

Options

Comments

  • The problem is that, since you've made the donation level a hidden input rather than prompting the user to choose a gift amount, validateForm() is invalid and causes the whole thing to fail (since "level_other" and "other_amount" don't exist). Remove that function and change:

    if (validateForm()) {

    // Tell the user that donation is processing

    displayAjaxLoading(true, 'Please wait while your transaction is being processed.');



    // Make the AJAX call

    var url = donate_form.action;

    var args = getFormAsQuery(donate_form);

    var myAjax = new Ajax.Request( url,

    {

    method: 'post',

    parameters: args,

    onSuccess: handleAjaxSuccess,

    onFailure: handleAjaxFailure,

    onException: handleAjaxFailure

    });

    }

    ... to:



    // Tell the user that donation is processing

    displayAjaxLoading(true, 'Please wait while your transaction is being processed.');



    // Make the AJAX call

    var url = donate_form.action;

    var args = getFormAsQuery(donate_form);

    var myAjax = new Ajax.Request( url,

    {

    method: 'post',

    parameters: args,

    onSuccess: handleAjaxSuccess,

    onFailure: handleAjaxFailure,

    onException: handleAjaxFailure

    });



    Once you do that, the AJAX form submission should work.

  • Noah Cooper:

    The problem is that, since you've made the donation level a hidden input rather than prompting the user to choose a gift amount, validateForm() is invalid and causes the whole thing to fail (since "level_other" and "other_amount" don't exist). Remove that function and change:

    if (validateForm()) {

    // Tell the user that donation is processing

    displayAjaxLoading(true, 'Please wait while your transaction is being processed.');



    // Make the AJAX call

    var url = donate_form.action;

    var args = getFormAsQuery(donate_form);

    var myAjax = new Ajax.Request( url,

    {

    method: 'post',

    parameters: args,

    onSuccess: handleAjaxSuccess,

    onFailure: handleAjaxFailure,

    onException: handleAjaxFailure

    });

    }

    ... to:



    // Tell the user that donation is processing

    displayAjaxLoading(true, 'Please wait while your transaction is being processed.');



    // Make the AJAX call

    var url = donate_form.action;

    var args = getFormAsQuery(donate_form);

    var myAjax = new Ajax.Request( url,

    {

    method: 'post',

    parameters: args,

    onSuccess: handleAjaxSuccess,

    onFailure: handleAjaxFailure,

    onException: handleAjaxFailure

    });



    Once you do that, the AJAX form submission should work.

    Thank you very much for your qick answer Noah

    I did what you recommended and now it will display error message only on the CC field. When I filled out everything on the form(CC# 4111111111111111), it did not process.

  • Hai Nguyen:

    Thank you very much for your qick answer Noah

    I did what you recommended and now it will display error message only on the CC field. When I filled out everything on the form(CC# 4111111111111111), it did not process.

    Forms have to be published to work with the Donation API and the test credit card number will not work on published form. You'll have to test with a live, real, credit card. I usually use my own, then refund it right away... it's a pain in the neck, but... c'est la vie!

  • Michael :

    Forms have to be published to work with the Donation API and the test credit card number will not work on published form. You'll have to test with a live, real, credit card. I usually use my own, then refund it right away... it's a pain in the neck, but... c'est la vie!

    Michael, look like I have to do the same. Also, it seems like the error message only work for the CC field. https://secure.oxfamamerica.org/site/SPageNavigator/donate_form_monthly_option?pagename=donate_form

    Thanks

Categories