Page 1 of 1

Custom Signup Field Validation

Posted: 2018-03-31 10:27
by thecomputerchap
Hi all,

I'm trying to do something and I'm a bit stuck so I need your help...

I have the custom1 field set to 'Business Name' when a user signs up. I am trying to apply validation checks to this field so that it behaves similar to the username field. There are no minimum number of characters like the username but I need to have AppGini check to see if there is a business name that already exists already in the custom1 field of the database as the user fills the field in.

To demonstrate how I need this to work, go to your signup form and start typing in a username. AppGini uses Ajax to check if a username already exists in the database as you type. I basically need this same functionality applied for the custom1 field too.

I'm not sure how to go about doing this...

Thanks all in advance for your help!

Re: Custom Signup Field Validation

Posted: 2019-06-17 23:04
by jmcgov
Can someone respond to this question, please?

Re: Custom Signup Field Validation

Posted: 2019-06-22 15:55
by a.gneady
You could add JavaScript code in hooks/footer-extras.php for validation … First, check that the URL is "membership_signup.php" and if so, add a form submission handler to check the field values … and if a value is invalid, show error and return false to prevent submission:

Code: Select all

<script>
    $j(function() {
        // if not signup page, skip
        if(!location.href.match(/\/membership_signup\.php/)) return;

        $j('form').submit(function() {
            // add your checks here and return false if invalid, else return true
        });
    })
</script>