How is the NC donation forms server response delivered to the client?

Options
Here's a tricky situation that we've been trying to workaround for a while without an adequate solution.


Our general practice in building donation forms is to essentially hide the NetCommunity system generated donation form part using css and javascript, while displaying our own html/css/javascript form on a page. We handle as many form validation errors as possible with javascript before the form is submitted using the hidden NC form to the NC servers.


There are always some server-side errors, however, that cannot be vetted through client-side code, such as when a credit card is declined, or there are errors like this: "Please call the number on the back of your card. Your bank requested that we do not honor this card."


We've had limited success using a JS setInterval and running what we call an errTimer function. This checks for the system-generated error messages that appear in the native NC html error message area (".BBFormValidatorSummary.DonationValidationSummary").html();. Essentially, every second or so, the interval runs, looks for any text strings that might have appeared in that validation summary area on the (hidden) form, and displays the error(s) on our non-NC html form that sits on top of the page.


There are a couple of problems with our method: it's a bit inefficient and clearInterval doesn't seem to work in order to stop the setInterval once the error does occur. I'm not sure why this doesn't work, but it seems to have something to do with parts of the page refreshing from the server and not the entire page when an error occurs.


Anyhoo, does this ring a bell for anybody? What would be ideal is if the server could respond to our javascript code when these errors occur so that we can build in our own conditional error handling for server-side errors, rather than spitting out text strings on the page. Does anybody have any tips for this?
Tagged:

Comments

  • Jesse Kelsey:
    Here's a tricky situation that we've been trying to workaround for a while without an adequate solution.


    Our general practice in building donation forms is to essentially hide the NetCommunity system generated donation form part using css and javascript, while displaying our own html/css/javascript form on a page. We handle as many form validation errors as possible with javascript before the form is submitted using the hidden NC form to the NC servers.


    There are always some server-side errors, however, that cannot be vetted through client-side code, such as when a credit card is declined, or there are errors like this: "Please call the number on the back of your card. Your bank requested that we do not honor this card."


    We've had limited success using a JS setInterval and running what we call an errTimer function. This checks for the system-generated error messages that appear in the native NC html error message area (".BBFormValidatorSummary.DonationValidationSummary").html();. Essentially, every second or so, the interval runs, looks for any text strings that might have appeared in that validation summary area on the (hidden) form, and displays the error(s) on our non-NC html form that sits on top of the page.


    There are a couple of problems with our method: it's a bit inefficient and clearInterval doesn't seem to work in order to stop the setInterval once the error does occur. I'm not sure why this doesn't work, but it seems to have something to do with parts of the page refreshing from the server and not the entire page when an error occurs.


    Anyhoo, does this ring a bell for anybody? What would be ideal is if the server could respond to our javascript code when these errors occur so that we can build in our own conditional error handling for server-side errors, rather than spitting out text strings on the page. Does anybody have any tips for this?

    Bumping this up--I know it's a tough post. Does anyone have experience with this on NetCommunity donation forms? Thanks!

Categories