====== Display a dropdown list with "Other" text box ====== The following snippet will display a dropdown list in the checkout, and will display an extra text box for “Other” input if “Other” is selected. ==== Add javascript ==== On the [[https://admin.foxycart.com/admin.php?ThisAction=TemplateConfig|Templates configuration]] page of your store's FoxyCart administration, under "Cart" look for "Add custom header or footer code to your website", check the box if not checked, and add this code into the "Footer" text area. {% if context == "checkout" %} {% endif %} ==== Add HTML ==== Next, and still on the configuration page, under "Checkout" look for "Add custom form fields to your checkout", enable it, and paste the following into the text box within:

Referred by?

{% if referral_source == "Other" %}
{% endif %}
==== Customize ==== You can customize some information to fit your needs. You can change ''referral_source'' wherever you see it to something more appropriate for your needs. Make sure you change it everywhere, including on the Javascript above. You can also change "How did you find Us?… (required)" and "Referred by?" to suit your needs. Option values can also be changed, but you'll need to make sure you change them to match in the following Twig "if" statement and within the '''' tags that displays the option to the customer. We don't recommend changing anything on the ''other'' option unless you fully understand the snippet. You can feel free to [[https://foxy.io/contact|contact us]] for additional help. This snippet sets the field to be required. If you don't want it to be required and need help changing that, please [[https://foxy.io/contact|contact us]].