Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paypal button issue with contact_form #8

Open
ghost opened this issue Dec 1, 2014 · 1 comment
Open

paypal button issue with contact_form #8

ghost opened this issue Dec 1, 2014 · 1 comment

Comments

@ghost
Copy link

ghost commented Dec 1, 2014

since i am using the plug in my paypal button do not work anymore.

Here are details about the issue on stackoverflow:
https://stackoverflow.com/questions/26650404/bootstrap-contact-me-being-submitted-from-another-button#_=_

@ghost
Copy link
Author

ghost commented Dec 6, 2014

Ok, so i tried something. I must admit that I am totally new to js and dont know if the following solution is bulletproof but both my PayPal button and the contactform are working now. Here is what i have done:

I went through the jqBootstrapValidation.js file and incrementally disabled parts of it until I found the spot that made my PayPal button work again. I found out that if line 49 of the js file:

var $inputs = $form.find("input,textarea,select").not("[type=submit],[type=image]").filter(settings.options.filter);

is disabled, the PayPal button works fine.

So next I wrapped the var into an if statement looking like this:

if (
     $form.hasClass("contactform")
   ) {
     var $inputs = $form.find("input,textarea,select").not("[type=submit],[type=image]").filter(settings.options.filter);
      }

so basically now the class "contactform" is needed in the html file to set the var $inputs.

My Contactform HTML looks like this now:

<div class="col-sm-offset-3 col-lg-6">
    <form name="sentMessage" id="contactForm" class="contactform" novalidate>
        <legend class="content-legend">Kontakt</legend>
        <div class="control-group">
            <div class="controls">
                <input type="text" class="form-control content-form" placeholder="Name" id="name" required data-validation-required-message="Bitte geben sie Ihren Namen ein" />
            </div>
        </div>
        <div class="control-group">
            <div class="controls">
                <input type="email" class="form-control content-form" placeholder="Mail" id="email" required data-validation-required-message="Bitte geben Sie eine Mailadresse ein" />

[...] etc.

e.g. the form contains the class "contactform".

My PayPal Button HTML looks like this:

<form target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post" id="paypalbutton" target="_top" style="float:right;">
    <input type="hidden" name="cmd" value="_s-xclick">
    <input type="hidden" name="hosted_button_id" value="xxx">
    <input type="submit" value="Jetzt zahlungspflichtig Bestellen" border="0" name="submit" title="Jetzt einfach, schnell und sicher online bezahlen – mit PayPal." class="btn btn-primary">
    <img alt="" border="0" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1" height="1">
</form>

e.g. the form does not contain the class "contactform". The var $inputs will not be set by the jqBootstrapValidation.js file and so it does not trigger what ever prevents the PayPal button from working.

I hope it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants