Results 1 to 10 of 18

Hybrid View

  1. #1
    Join Date
    Sep 2006
    Location
    Jacksonville, FL
    Posts
    236
    Plugin Contributions
    0

    help question Create Required Referral Field

    I am trying to make my referral field required. I know the customers won't always be honest when they fill in the text box, but the bossman wants this feature. I went to my includes/modules/pages/create_account/jscript_form_check.php and added the following code:
    Code:
    // referral required begin
    
      check_input("customers_referral", "", "<?php echo ENTRY_CUSTOMERS_REFERRAL_ERROR; ?>");
       
    // referral required end
    Then I went to includes/languages/MYTEMPLATE/english.php and added the following bit of code:
    Code:
      
    define('ENTRY_CUSTOMERS_REFERRAL_ERROR', 'Please let us know how you heard about StudioStyles.net');
    When I view my source, it looks like everything is being called out properly, but the required field does not seem to be working. Anyone have an idea?

    Login URL:
    John L.
    MultiMedia Designer

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Create Required Referral Field

    Trace down one of the other required fields such as:
    street_address

    You have not added anything to the validation of the information you only added the flag to tell the customer the field is required ...

    Peek in the file:
    jscript_form_check.php

    for login and create_account ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Sep 2006
    Location
    Jacksonville, FL
    Posts
    236
    Plugin Contributions
    0

    help question Re: Create Required Referral Field

    Ajeh,

    Thanks for the tip, but Im not seeing login or create_account in my jscript_form_check.php file. Perhaps this is because I have split login mod...
    John L.
    MultiMedia Designer

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Create Required Referral Field

    /includes/pages/login

    /includes/pages/create_account

    Are you looking at the right files?
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Sep 2006
    Location
    Jacksonville, FL
    Posts
    236
    Plugin Contributions
    0

    help question Re: Create Required Referral Field

    Im editing the one in create_account dir. Ive copied the street_address line from there and modified it to get the customers_referral_error message. Here's my page source JS:
    Code:
    <script language="javascript" type="text/javascript"><!--
    
    var form = "";
    
    var submitted = false;
    
    var error = false;
    
    var error_message = "";
    
    function check_input(field_name, field_size, message) {
    
      if (form.elements[field_name] && (form.elements[field_name].type != "hidden")) {
    
        var field_value = form.elements[field_name].value;
    
        if (field_value == '' || field_value.length < field_size) {
    
          error_message = error_message + "* " + message + "\n";
    
          error = true;
    
        }
    
      }
    
    }
    
    function check_radio(field_name, message) {
    
      var isChecked = false;
    
      if (form.elements[field_name] && (form.elements[field_name].type != "hidden")) {
    
        var radio = form.elements[field_name];
    
        for (var i=0; i<radio.length; i++) {
    
          if (radio[i].checked == true) {
    
            isChecked = true;
    
            break;
    
          }
    
        }
    
        if (isChecked == false) {
    
          error_message = error_message + "* " + message + "\n";
    
          error = true;
    
        }
    
      }
    
    }
    
    function check_select(field_name, field_default, message) {
    
      if (form.elements[field_name] && (form.elements[field_name].type != "hidden")) {
    
        var field_value = form.elements[field_name].value;
    
        if (field_value == field_default) {
    
          error_message = error_message + "* " + message + "\n";
    
          error = true;
    
        }
    
      }
    
    }
    
    function check_password(field_name_1, field_name_2, field_size, message_1, message_2) {
    
      if (form.elements[field_name_1] && (form.elements[field_name_1].type != "hidden")) {
    
        var password = form.elements[field_name_1].value;
    
        var confirmation = form.elements[field_name_2].value;
    
        if (password == '' || password.length < field_size) {
    
          error_message = error_message + "* " + message_1 + "\n";
    
          error = true;
    
        } else if (password != confirmation) {
    
          error_message = error_message + "* " + message_2 + "\n";
    
          error = true;
    
        }
    
      }
    
    }
    
    
    
    function check_password_new(field_name_1, field_name_2, field_name_3, field_size, message_1, message_2, message_3) {
    
      if (form.elements[field_name_1] && (form.elements[field_name_1].type != "hidden")) {
    
        var password_current = form.elements[field_name_1].value;
    
        var password_new = form.elements[field_name_2].value;
    
        var password_confirmation = form.elements[field_name_3].value;
    
    
    
        if (password_current == '' || password_current.length < field_size) {
    
          error_message = error_message + "* " + message_1 + "\n";
    
          error = true;
    
        } else if (password_new == '' || password_new.length < field_size) {
    
          error_message = error_message + "* " + message_2 + "\n";
    
          error = true;
    
        } else if (password_new != password_confirmation) {
    
          error_message = error_message + "* " + message_3 + "\n";
    
          error = true;
    
        }
    
      }
    
    }
    
    
    
    function check_form(form_name) {
    
      if (submitted == true) {
    
        alert("This form has already been submitted. Please press OK and wait for this process to be completed.");
    
        return false;
    
      }
    
      error = false;
    
      form = form_name;
    
      error_message = "Errors have occurred during the processing of your form.\n\nPlease make the following corrections:\n\n";
    
      check_radio("gender", "Please choose a salutation.");
    
      check_input("firstname", 2, "Is your first name correct? Our system requires a minimum of 2 characters. Please try again.");
    
      check_input("lastname", 2, "Is your last name correct? Our system requires a minimum of 2 characters. Please try again.");
    
      check_input("email_address", 6, "Is your email address correct? It should contain at least 6 characters. Please try again.");
    
      check_input("street_address", 5, "Your Street Address must contain a minimum of 5 characters.");
    
      // check_input("postcode", 0, "Your Post/ZIP Code must contain a minimum of 0 characters.");
    
      check_input("city", 2, "Your City must contain a minimum of 2 characters.");
    
      if (!form.state.disabled && form.zone_id.value > 0) check_input("state", 0, "Your State must contain a minimum of 0 characters.");
    
      check_select("country", "", "You must select a country from the Countries pull down menu.");
    
      check_input("telephone", 10, "Your Telephone Number must contain a minimum of 10 characters.");
    
      check_password("password", "confirmation", 5, "Your Password must contain a minimum of 5 characters.", "The Password Confirmation must match your Password.");
    
      check_password_new("password_current", "password_new", "password_confirmation", 5, "Your Password must contain a minimum of 5 characters.", "Your new Password must contain a minimum of 5 characters.", "The Password Confirmation must match your new Password.");
    
    // referral required begin
    
      check_input("customers_referral", 2, "Please let us know how you heard about StudioStyles.net");
       
    // referral required end
    
    
      if (error == true) {
    
        alert(error_message);
    
        return false;
    
      } else {
    
        submitted = true;
    
        return true;
      }
    }
    and here's the HTML:
    Code:
    <fieldset>
    
    <legend>Were You Referred to Us?</legend>
    <label class="inputLabel" for="customers_referral">Referral Source:</label>
    <input type="text" name="customers_referral" value="" size = "16" maxlength= "32" id="customers_referral" /><span class="alert">*</span><br class="clearBoth" />
    </fieldset>
    John L.
    MultiMedia Designer

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Create Required Referral Field

    How come you are not using the constants and are using physical values?
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 

Similar Threads

  1. v139h How to make customer referral a required field during create account?
    By idc1 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 16 Jan 2012, 09:47 PM
  2. Making Company Field on Create Account Required
    By pioupioun in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 21 Oct 2010, 04:31 PM
  3. New Report on Referral Code required. Possible?
    By rgeorgiou in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 9 Nov 2007, 04:13 AM
  4. Make Referral Info Required
    By Toot4fun in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 2 Oct 2007, 12:26 AM
  5. State Field Not Required During Registration but Required in Admin?
    By Stenrique in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 2 Jun 2007, 09:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg