Support » Plugin: cformsII » Adding onclick/onsubmit functionality?

  • Resolved Paul Hartman

    (@paul-hartman)


    Form for community association membership and donations. I would like to add the membership fee (radio buttons) plus an optional additional donation value (could be zero) to make a total dollar value that is sent to Paypal. Need to display it before user clicks submit. Is there a way to add some Javascript and onclick/onsubmit functions to certain fields?

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author bgermann

    (@bgermann)

    Sure. That is not dependent on cformsII. Just make your JavaScript run on the page with the form and then you can add handlers for the form’s elements.

    I was hoping for a few more hints than that, I’m not a Javascript guru. Do you have any examples handy?

    Another question — When I post the form to Paypal there is no confirmation email sent to admin. Paypal doesn’t send most of the fields collected via the form. Is there any way to have cformsII send the admin email with all the info after Paypal completes the transaction?

    Plugin Author bgermann

    (@bgermann)

    You lose all cformsII processing if you hand over the form request to PayPal. If PayPal exposes a REST API that signals back to you when they have processed the request, maybe there is a way using a cformsII hook. You would have to generate the API request yourself, wait for the response and then continue processing in cformsII.

    The cformsII solution to part of your problem would be using a regular expression on the dollar field. I do not have an example for the thing you want to do with JavaScript; just ask in a general JavaScript forum. You want to do something like document.getElementById("li-2-2items").addEventListener("click", function(){ ... })

    I have given up on doing any math magic, The site has to go live on Friday so I have no time.

    The problem I am having now is I am trying to have a multi-part form. Page 1 sends the admin email (and stores in DB) when user clicks “Continue” button. Page 2 displays the form field values then submits to Paypal when user clicks “Submit” button. It works until I edit Page 1 form to change something and when I load the page containing the form (Page 1) it skips Page 1 of the form and goes right to Page 2 and displays blank fields. I have cleared caches (server and browser) with no effect. The “Back” button goes to Paypal instead of to Page 1.
    http://us222.siteground.us/~sgcpc499/donations-menu/membership/

    I figured it out. If I delete cookies for the site in the browser it works.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Adding onclick/onsubmit functionality?’ is closed to new replies.