Configure custom form field

We have a custom form field for a referral source. This custom form field is not necessary for returning customers. Is there a way to make this custom form field not show up for returning customers?

Here is the code for our custom form field:
{% if referral_source is not defined %}
{% set referral_source = "" %}
{% for key, custom_field in custom_fields %}
{% if key == "referral_source" %}
{% set referral_source = custom_field.value %}
{% endif %}
{% endfor %}
{% endif %}




Who referred you to Ximo?





Please tell us who referred you to Ximo.





By clicking Confirm Your Order I agree to the Terms and Conditions, Policies and Procedures, the E-Sign from XimoRocks

Tagged:
Comments

  • {% if referral_source is not defined %}
    {% set referral_source = "" %}
    {% for key, custom_field in custom_fields %}
    {% if key == "referral_source" %}
    {% set referral_source = custom_field.value %}
    {% endif %}
    {% endfor %}
    {% endif %}
    <div class="fc-form-group" data-fc-error-for="referral_source" data-fc-error-class="fc-alert-container--error">
    <div class="col-sm-8 col-sm-offset-3">
    <div class="fc-input-group-container fc-input-group-container--active">
    <label class="fc-input-group-container__title fc-input-group-container__title--forced fc-form-label">
    Referred by &#40;Name&#41;
    </label>
    <div class="fc-form-group">
    <p>Who referred you to Ximo?</p>
    <input type="text" id="referral_source" name="referral_source" placeholder="" autocomplete="off" class="fc-form-control" aria-required="true" value="{{ referral_source }}" data-fc-required>
    </div>
    </div>
    <div class="fc-alert fc-alert--danger hidden" data-fc-error-for="referral_source" data-fc-error-class="show,hidden">
    <div class="">Please tell us who referred you to Ximo.</div>
    </div>
    </div>
    </div>

    <div class="col-sm-8 col-sm-offset-3">
    <p>By clicking Confirm Your Order I agree to the <a href="http://apricot.ximo365.com/Terms-and-conditions-2015.pdf" target="_blank">Terms and Conditions</a>, <a href="http://apricot.ximo365.com/Policies-and-Procedures-v9.pdf" target="_blank">Policies and Procedures</a>, the <a href="http://apricot.ximo365.com/E-Sign-Notice-v3.pdf" target="_blank">E-Sign</a> from XimoRocks</p>
    </div>
  • fc_adamfc_adam FoxyCart Team
    @jrwhip,

    You could try wrapping your conditional code in {% if not authentication_is_successful %} {% endif %} - which should only then display if the user is not authenticated.
  • Thanks
Sign In or Register to comment.