Help Required - cross field validation on signup

Discussion in 'Customization & add-ons' started by Pangdene, Sep 28, 2004.

  1. Pangdene

    Pangdene New Member

    Joined:
    Aug 17, 2004
    Messages:
    26
    Hi,

    I hope someone can point me in the right direction with this!

    I have a field that I've added via the Admin CP and I want this field to be mandatory on the signup form if a certain product has already been selected on the signup form - how can I do this?

    Any help appreciated!

    Thanks,
    Mark :)
  2. alex

    alex Administrator Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,020
    You can do the following:
    create file amember/site.inc.php with the following content:

    PHP:
    <?php
    function vsf($vars){
        
    $e = array();
        if ((
    $vars['product_id'] == 5) && $vars['my_field'] == '')
             
    $e[] = "Please enter value for My FIELD";
        return 
    $e;
    }
    setup_plugin_hook('validate_signup_form''vsf');
    ?>
    I hope you see that values 5 and my_field must be replaced. If something is wrong, please contact support with URL, aMember CP and FTP info. We will not debug it in the forum, OK? :)
  3. Pangdene

    Pangdene New Member

    Joined:
    Aug 17, 2004
    Messages:
    26
    brilliant - thanks Alex!

    I'll definitely give that a try. :D

    Regards,
    Mark :)

Share This Page