Custom Signup Field Validation

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
thecomputerchap
Veteran Member
Posts: 42
Joined: 2016-08-28 10:37

Custom Signup Field Validation

Post by thecomputerchap » 2018-03-31 10:27

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!

User avatar
jmcgov
Veteran Member
Posts: 40
Joined: 2018-12-19 01:31

Re: Custom Signup Field Validation

Post by jmcgov » 2019-06-17 23:04

Can someone respond to this question, please?

User avatar
a.gneady
Site Admin
Posts: 1035
Joined: 2012-09-27 14:46
Contact:

Re: Custom Signup Field Validation

Post by a.gneady » 2019-06-22 15:55

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>
:idea: Learn all the tips and tricks of customizing AppGini apps through our online course.
:arrow: Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
:arrow: Summary Reports plugin: Build powerful reports and charts for your AppGini apps.
:arrow: Search Page Maker: Compose user-friendly yet powerful search pages for your AppGini apps.

Post Reply