Stuck on OLX forms - am I trying to do too much!?!?

Options
Greetings! 


I wonder if anyone with much more knowledge on OLX forms then me can help with a dilemma I have, please. 

We have 2 donation forms on the site, one for single payments, and the other for recurring. We have built a separate static component (let’s call it our ‘First step') on our site that allows the user to configure the basics of their donation before being directed on to the appropriate Blackbaud form. They select between ‘Single' or ‘Regular’, and then either one of 4 pre-determined amounts (e.g. 10/25/50/100 - these amounts are mirrored in the BB forms) OR an ‘other amount’ which can be any value.

It’s fairly simple, from the selection in the 'First step’, I am bringing the value over in a query string, and then using javascript to select the appropriate radio button on the BB form, and if required populate the ‘Other' field on the BlackBaud form. The radio button selection is working fine, but it is the ‘Other’ field that is the issue. 

I am setting the value attribute on the following 3 inputs:


 
  1. input#bboxdonation_gift_rdGivingLevel5 (This is the radio button input for the ‘Other amount’ )
  2. input#bboxdonation_gift_txtOtherAmountButtons (This is the visible text input inside the label that appears directly after the radio button ‘Other amount’ above)
  3. input#bboxdonation_hdnBBCheckoutAmount (This is the hidden input amount field further down the form, after the main ‘#bboxdonation_BBEmbeddedForm’ element)
All 3 of these input values are being set when the BB form initially loads. 

When the completed form is then submitted, the ‘Processing’ message appears, but then I get a 'Please specify a gift amount’ message, and input number 1 has no value assigned to it, and input number 3 has it’s value reset to ‘0’. The value of number 2 remains in place.

So my question is primarily: Is what I am doing possible? …  and if so, what steps/fields am I missing? Any advice/pointers would be great.

Thank you!
Tagged:

Comments

  • Hi


    I have moved this forum post from the to the OLX Community in hopes of getting more product specific eyes & replies...


    In harmony and inclusion,

    Elizabeth

    Blackbaud Community Team
  • Thank you!! 
  • Hi J KamaraFrederick‍. I like how you're approaching the flow for your donors. Hopefully the info I'm able to share will help a bit. 


    First, and it might not save you any time at this point, there's a first class URL param you can use that will cause the selected gift amount to be set programmatically:


    http://www.charity.org/donate?BBGiftAmount=100


    will set the gift amount on the form to $100 if and only if $100 is one of the suggested gift amounts. We call these URL params "magic links" and you can see a bit about them on the last step of the form editor where you grab your form code snippet.


    Using the above URL param, it doesn't matter how many suggested gift amount buttons you have on the form...as long as the value you set to this URL param matches one of the suggested amounts on your form, then when the form loads that amount will be selected.


    Another handy URL param that works in conjunction with the one above is this one:


    http://www.charity.org/donate?BBGiftAmount=100&BBHideOtherGifts=1


    Setting this URL param to "1" will cause the form to hide the other suggested gift amount buttons. Again, this only works when using these URL params to set the gift amount to one of the suggested amounts you've configured on your form.


    But these don't help with how you want to programmatically set gift amount to some other amount of the Donor's choosing. I could be wrong, but you may just need to set a class on the elements that capture the other gift amount on the form. It sounds like you're correctly setting the other amount but if you're not also programmatically "clicking the button", the form may be behaving as though the user hasn't made a choice of gift amount yet (even though a value has been programmatically entered into the Other Amount field). 


    If you open up your browser dev tools console and watch the Other Amount elements as you manually click the Other Amount button, you'll see a few classes get added indicating that Other Amount has been selected. The <input> element gets the class BBFormRadioGivingLevelSelected and its associated label gets the class BBFormRadioLabelGivingLevelSelected. Try programmatically applying those classes when the donor has chosen an amount other than one of the suggested amounts and see if the form processes correctly for you.


    Hopefully that helps some. Thanks and good luck!

    Chris Martin

    Blackbaud Product Management

     
  • Greetings Chris, 


    Thanks very much for your details response - very much appreciated.   Interestingly you've described exactly what it is that I’m already doing... So I’m wondering if it is just not possible? 


    =0(  Any thoughts on next steps?


    Thanks again!


    J'
  • Hi J KamaraFrederick‍. With a little local testing, the following seems to have worked and allowed the programmatically-set other amount to be passed in for payment processing. It maybe just calling the click() function on the right element? Also, I don't think you need to manipulate the value of the input with the ID = bboxdonation_hdnBBCheckoutAmount. The form's baked-in behavior should set that amount automatically (whether the donation amount is set by the donor or by your script).


    Try this out:


    document.getElementsByClassName("BBFormRadioDescriptionOther")[0].click()

    document.getElementById("bboxdonation_gift_txtOtherAmountButtons").value = 55


    Thanks!

    Chris Martin

    Blackbaud Product Management
  • Greetings Chris, 


    Thank you very much for your help. We managaned to get this sorted a few hours ago. 


    Thank you again.


    J'

Categories