tslater2000
Forum Replies Created
-
Okay, thanks for answering all my questions. I’ll mark this topic as resolved.
okay, I think I have it all working now. thanks so much
is there a way to put focus on the cardnumber field when the form loads?
Stripe validation happens in two places, right? It happens while the user is typing in the card number (before clicking the submit button) and then once the user submits the form.
I’m looking for a listener for when the user presses the submit button and it comes back as an invalid entry.
Is that also something that forminator doesn’t read?
I know it’s possible as I’ve seen it on another company’s form demo – I just can’t figure it out.
As for the border, it happens when there’s focus on it as I refresh the page. I don’t really have a live sample to look at without populating a cart and billing info etc but I’ll just look into the different css classes and see which one needs to be outline: 0
Also, how do I css get rid of this black border?
Hi Patrick
Thanks so much for taking the time to figure this out for me.
This new code worked but I found I didn’t need this part of the code:
}).on(‘forminator:form:submit:failed’, function(e, formData){
console.log(‘falied’);
_event_triggered = -1;as it doesn’t do anything on fail
and the “always” console.log is actually “fail”
so the final code looks like this:
`var _event_triggered = 0;
jQuery(‘body’).on(“forminator:form:submit:success”, function(e, formData)
{
console.log(‘success’);
_event_triggered = 1;}).on(‘after:forminator:form:submit’, function(e, formData){
if( ! _event_triggered ){
console.log(‘fail’);
// add their custom code here.
}
// reset.
_event_triggered = 0;
});`ONE FINAL QUESTION:
I have jQuery code that detects when the form is submitted so it changes the text of the button from “pay” to “processing…”However, I need to be able to detect when validation fails before the form sends to stripe (ie. “your card number is incomplete”, “your card’s expiration date is invalid”) so I can switch the button text back to “pay”
Again, thanks for all you help.
Todd
- This reply was modified 3 years, 4 months ago by tslater2000.
Hi Patrick
I figured out why the embeded code wasn’t working. The jquery script wasn’t being loaded because the embeded code was on a page and not a post so the following code was causing it not to load the jquery script below it.
global $post; if( ! $post instanceof WP_Post || ! has_shortcode( $post->post_content, 'forminator_form' ) ) { return; }
I am, however, still in need of detecting a fail.
Should I start a new topic for that or should I just wait here in this topic for the developers to get back to you?
Both the wp_header and wp_footer are included. I have no idea why the form works perfectly both ways but will not do the success function on the embeded.
also, the fail option doesn’t work at all either way:
forminator:form:submit:failedOkay, I was able to get the code to work but it’s still not working for what I want.
If I add this code to a page and load the page, it will show the form and also do the success function properly:
[forminator_form id=”808″]
HOWEVER, and this is a big one, if I have the code inserted into a php page like this:
<?php echo do_shortcode(‘[forminator_form id=”808″]’); ?>
it will still send all the information to stripe but will not run the success function.
I’ve tried to figure out why the php won’t work but I have no idea.
Hi Patrick
I’ve tried to make this code work on my end but am having no luck. I’ve uninstalled my child theme and even inserted my form shortcode into a unique empty page with no results.
Is it possible it’s not working because I’m in test mode? Or does it need to be forminator-pro to work?
Hi Patrick
It does not like forminator:form:submit:failed at all. Nothing happens.
I feel like it should be super easy to do considering the forminator plugin is obviously getting a response back since it’s showing fail/success text messages on the form. I just can’t find the answer anywhere.