#NormanLove

1 messages ยท Page 1 of 1 (latest)

fierce cypressBOT
feral folio
#

users can click button 7 times and it will create 7 customers and charges. not cool Stripe. ๐Ÿ™‚

zinc cobalt
#

Well it's your custom code, so you control what happens with that

feral folio
#

im sure you have encountered this before and have a solution

zinc cobalt
#

Are you using the card element?

feral folio
#

I have JQuery in place to disable the button and its not happening

zinc cobalt
#

Or payment element?

feral folio
#

yeah elements

#

well not sure ill p[aste code

#

says card elements everywhere

#

I have a class register-btn on the button and jquery has: $('.register-btn').click(function() {
$('.register-btn').attr({disabled: 'true'});
$('.register-btn').html('Please wait....may take a few seconds');

          });
#

is this the normal way, just use Jquery right?

#

yes card elements

zinc cobalt
#

Well there's not a normal way per-se. If you're using a custom integration flow with the card element, then it's totally up to you on how you handle that. JQuery should be fine

#

But above isn't enough for me to tell what's going on. Regardless, this is an issue with your code, not Stripe's

feral folio
#

i have tried to style a card element peior but changes added to style.css did not effect card elements

#

so I figured it was the same with JQuery. I dunno. I do know the form button is not responding to plain Jquery

zinc cobalt
#

But the button is something you created right?

#

Can you share more of your code?

feral folio
#

Your answer was helpful actually, it made me go take another look at my code and I saw what the issue was. ๐Ÿ™‚

zinc cobalt
#

Ah

#

Cool glad you got it sorted out

feral folio
#

was my error

#

Ill be back later thogh for the css I could not change ๐Ÿ™‚

#

your like a therapist. you tell me to take a look at my own code and it works! problem solved. I want to see you once a week

#

๐Ÿ˜†

zinc cobalt
#

Haha glad to be of service

feral folio
#

ok, im back. the button became disabled...yeah! but the form never submits. just stands there saying waitin.. on the button, as I coded it. So I added $('.register-btn').click(function(event) {
event.preventDefault(); // Prevent the default action of the button
$('.register-btn').attr({disabled: 'true'});
$('.register-btn').html('Please wait..');
$('form').submit(); // Submit the form manually
});

#

ao I added submit to jquery and it looks like stripe just responds Error on form submission, please try again.

#

Like stripe didnt like the fact that I submitted the form via JQuery

#

like if I submit form card Elements aborts sending to stripe

zinc cobalt
#

Just submitting the form shouldn't automatically send all your details to Stripe. Can you send more of your frontend code so I can see what you're doing in full?

feral folio
#

following is the entire register.php

#

I believe somewhere in your scard elements code I have to tell it to disable button after click, which should be the norm

#

but it aint

zinc cobalt
#

Hm can you share a screenshot of the error message? Is there more detail?

feral folio
#

this was fully tested and would submit in testing moide to stripe, just adding the new code makes it do this

#

the error would be large h1 title text like that when coming from stripe, so its a stripe thing, the smaller text is my own error code

#

somewhere in all the cardelements code, I should be able to add something to make it disable the button. just havent figured it out yet. searching google at the moment

zinc cobalt
#

I don't think you need the jquery if you don't want. Before, you just had this code for submit?

    e.preventDefault();
    createToken();
});```
What did it look like before the change?
feral folio
#

ok, I figured it out. I just added the one line of JQuery AFTER your elements code to submit and it worked, button disabled and foem submitted. here is the code that worked: function stripeTokenHandler(token) {
// Insert the token ID into the form so it gets submitted to the server
var hiddenInput = document.createElement('input');
hiddenInput.setAttribute('type', 'hidden');
hiddenInput.setAttribute('name', 'stripeToken');
hiddenInput.setAttribute('value', token.id);
form.appendChild(hiddenInput);

// Submit the form
form.submit();

$('.register-btn').attr({disabled: 'true'});

}

#

so basically if you want something to happen after you submit, place jquery after where it says submit in elements and viola! ๐Ÿ™‚ thanks again doc.

zinc cobalt
#

Cool