Page 1 of 1

Form Validation

PostPosted: January 7th, 2012, 1:02 am
by Stephem
Hey guys,

I have yet another question. I'm looking to make the validation process a little more advanced when it comes to the Paypal Pro forms.

As you know, by default the s2Member javascript uses a simple popup box with the "Oops you've missed something" error.

Is there a way i can remove this, allowing the use of a custom built jquery validation script to be used instead?

Re: Form Validation

PostPosted: January 7th, 2012, 4:02 am
by xigaogen
Maybe you can check and repair the file:
wp-content\plugins\s2member\includes\s2member-min.js

Hope this can help you.

Re: Form Validation

PostPosted: January 7th, 2012, 6:19 am
by Cristián Lávaque
Have you tried using a custom pro-form template and changing the form's IDs? I'm not sure if that'll work, but that's what I'd try first.

Is it possible to modify the PayPal® and/or Authorize.Net® Pro Form templates?

Usually not necessary. But yes, if you really need to. Please check your /s2member-pro/includes/templates/forms/ directory. You can take the default templates, and place some ( or all of them ) into your own WordPress® theme directory. s2Member Pro will automatically find your custom templates there. By placing custom templates into your theme directory, you can be sure they won't get overwritten in a future upgrade. Either that, or you can just use the default templates like they are, and customize them with your own CSS rules inside the Stylesheet for your WordPress® theme ( i.e. style.css ). If you're using a PriMo Theme ( for instance, the s2Clean Theme ), check your Theme Options Panel, under: Custom CSS / Style Sheet.

Re: Form Validation

PostPosted: January 11th, 2012, 5:11 am
by Stephem
Hey Christian,

I have edited the paypal-checkout-form.php file by firstly removing the "aria-required" field from the inputs, as well as adding a class related to my validation script. It's working.

The problem is i need to apply these changes to my custom fields also, but it appears as though the custom fields HTML is generated in another file. Which file would this be?

Re: Form Validation

PostPosted: January 11th, 2012, 5:51 am
by Stephem
Follow up,

I'm blind. I found the file to edit the custom fields (custom-reg-fields.inc.php). I included it in the mu-plugins folder so it wouldn't be overwritten with future updates.

I do have one small problem though. When the 'submit' button is clicked the custom validation script works correctly, but the submit button changes to "Processing..." and repeats itself.

It doesn't change from this state, so even if the form is filled out correctly the submit button no longer works. How would i go about correctly this? Sorry about all the questions!

Re: Form Validation

PostPosted: January 12th, 2012, 6:36 am
by Cristián Lávaque
If you remove the customizaiton in the mu-plugins directory, do you still have that problem? If so, then it may be caused by another plugin, if not then there's something in the customization you wrote that's causing it. If the latter, could you post the code here, please?

Re: Form Validation

PostPosted: January 12th, 2012, 8:26 am
by bitofgrace
Hi-
I was searching for a way to make a custom field require validation against an invitation code list.
(i'm inviting users to the free reg form - while the system is not open reg. they're given a code to come activate with)
But i have no way of automating the code validation.

Is coding a separate process the only way to go about it?

Re: Form Validation

PostPosted: January 12th, 2012, 8:09 pm
by Stephem
Cristián Lávaque wrote:If you remove the customizaiton in the mu-plugins directory, do you still have that problem? If so, then it may be caused by another plugin, if not then there's something in the customization you wrote that's causing it. If the latter, could you post the code here, please?


Thanks for the reply.

There's nothing in the customization that's causing it, it's part of the s2Member javascript. I've looked in the file and being relatively new to javascript i do not know how to remove it.

You can view what i'm talking about here:

http://stephenjohnmartin.com/spa/membership/supporter/

By clicking submit without entering anything into the form, the validation script works, but the "Processing" action causes the form submission to break.