Here's what I'm trying to do:
User wants to purchase a coupon.
There is a limit to the total number of coupons available.
If the user intends to purchase more than the remaining number of coupons, display an error message and user ends up back at the form to try a smaller amount for purchase.
If the user intends to purchase coupons and there are still enough remaining coupons, redirect the user to PayPal for purchase.
I have a very simple form and I'm using the Redirect Plugin for getting to PayPal.
This is working very well.
Now, I need to put in the code that calculates whether or not the number of coupons the user requests are available.
As a simple test, I followed http://www.chronoengine.com/forums.html?cont=posts&f=2&t=11560&p=17018#p17018 and made a simple test:
On the form General tab: Form tag attachment: onSubmit="return Validate()"
On the form Form Code, Form Javascript:
I had expected the alert message to pop, but it did not.
Instead the redirect to PayPal happened.
How can I perform the check on number of coupons requested before redirecting to PayPal?
User wants to purchase a coupon.
There is a limit to the total number of coupons available.
If the user intends to purchase more than the remaining number of coupons, display an error message and user ends up back at the form to try a smaller amount for purchase.
If the user intends to purchase coupons and there are still enough remaining coupons, redirect the user to PayPal for purchase.
I have a very simple form and I'm using the Redirect Plugin for getting to PayPal.
This is working very well.
Now, I need to put in the code that calculates whether or not the number of coupons the user requests are available.
As a simple test, I followed http://www.chronoengine.com/forums.html?cont=posts&f=2&t=11560&p=17018#p17018 and made a simple test:
On the form General tab: Form tag attachment: onSubmit="return Validate()"
On the form Form Code, Form Javascript:
function Validate(){
if(1 != 2){
alert('Your passwords do not match');
return false;
}else{
return true;
}
}
I had expected the alert message to pop, but it did not.
Instead the redirect to PayPal happened.
How can I perform the check on number of coupons requested before redirecting to PayPal?
Hi edog5948 ,
Your code works here, so something else is going on. Please post a link to the form so we can take a quick look.
Bob
Your code works here, so something else is going on. Please post a link to the form so we can take a quick look.
Bob
Hi edog5948,
Are you sending them to Admin? That's not me. Click the PM link under my picture please.
Bob
Are you sending them to Admin? That's not me. Click the PM link under my picture please.
Bob
Hi edog5948,
Got it now thank you - in many copies :-)
It's fixed - when I looked at the form I remembered that we'd seen this problem once before. When LiveValidation is enabled it hijacks the 'onSubmit' event so your script is never fired.
I've added an id='submit' to the submit input and added a code snippet to call the Validate function when it is clicked. This happens before the submit so it fires OK.
Bob
Got it now thank you - in many copies :-)
It's fixed - when I looked at the form I remembered that we'd seen this problem once before. When LiveValidation is enabled it hijacks the 'onSubmit' event so your script is never fired.
I've added an id='submit' to the submit input and added a code snippet to call the Validate function when it is clicked. This happens before the submit so it fires OK.
Bob
OH, so close...
The alert triggers (as expected), but the redirect continues on (not wanted).
When the alert triggers, I need to take the user back to the original form, not get redirected on.
Any ideas?
The alert triggers (as expected), but the redirect continues on (not wanted).
When the alert triggers, I need to take the user back to the original form, not get redirected on.
Any ideas?
This topic is locked and no more replies can be posted.