Skip to content

Instantly share code, notes, and snippets.

@DeskWOW
Last active December 23, 2015 15:19
Show Gist options
  • Save DeskWOW/33ce54ae283c134a1fd1 to your computer and use it in GitHub Desktop.
Save DeskWOW/33ce54ae283c134a1fd1 to your computer and use it in GitHub Desktop.
Dec 23, 2016 Update: Desk has just released a new feature - Dependent Dropdowns - that is easy to set up and manage within the Desk Admin UI. Read more here: https://support.desk.com/customer/en/portal/articles/2166248
A simple dependent dropdown in Desk.com support center contact form.
Demo: https://zzz-ty.desk.com/customer/portal/emails/new?t=451478
<style>
.order-number {
display: none;
}
</style>
<div id="desk-external-variables-email_new" class="desk-external-variables">
<div id="system-snippets-name_required">{{system.snippets.name_required}}</div>
<div id="system-snippets-email_required">{{system.snippets.email_required}}</div>
<div id="system-snippets-invalid_email">{{system.snippets.invalid_email}}</div>
<div id="system-snippets-subject_required">{{system.snippets.subject_required}}</div>
<div id="system-snippets-question_required">{{system.snippets.question_required}}</div>
<div id="system-snippets-exceeding_max_chars">{{system.snippets.exceeding_max_chars}}</div>
</div>
<div id='breadcrumbs'>
<a href='{{desk.system.links.home}}'>{{system.snippets.home}}</a> &rsaquo; {{system.snippets.email_us}}
</div>
<div id='support-main'>
<div class='support-body'>
<div class='content'>
<h3>{{system.snippets.email_us}}</h3>
<div id='form'>
{{form_begin}}
{% if current_user == nil or current_user.is_guest %}
<div class='input-block'>
<span class='label'>
{{system.snippets.your_name}} <span>({{system.snippets.required}})</span>
</span>
<div>
<input value='{{ interaction.name }}' id='interaction_name' maxlength='100' name='interaction[name]' type='text' />
</div>
</div>
<div class='input-block'>
<span class='label'>
{{system.snippets.your_email}} <span>({{system.snippets.required}})</span>
</span>
<div>
<input value='{{ interaction.email }}' id='interaction_email' maxlength='100' name='interaction[email]' type='text' />
</div>
</div>
{% endif %}
<div class='input-block category'>
<span class='label'>
Category
</span>
<div>
{{ ticket_custom_category }}
</div>
</div>
<div class='input-block order-number'>
<span class='label'>
Order Number
</span>
<div>
{{ ticket_custom_order_number }}
</div>
</div>
<div class='input-block'>
<span class='label'>
{{system.snippets.subject}} <span>({{system.snippets.required}})</span>
</span>
<div>
<input id='email_subject' maxlength='100' name='email[subject]' type='text' value='{% if search_term and search_term != '' %}{{search_term}}{% else %}{{email.subject}}{%endif%}'/>
</div>
</div>
<div class='input-block'>
<span class='label'>
{{system.snippets.message}} <span>({{system.snippets.required}})</span>
</span>
<div>
<textarea id='email_body' name='email[body]'>{{email.body}}</textarea>
</div>
</div>
<div class='input-block'>
<span class='label'>
{{system.snippets.file_attachment}}
</span>
<div class="desk_file_upload">
<input name="case_attachment[attachment]" size="84" type="file"/>
<div class="faux-file-field">
<input type="text" disabled="disabled"/>
</div>
<input type="button" value="{{system.snippets.choose_file}}"/>
</div>
</div><br/>
<div class='input-button'>
<input id='email_submit' name='commit' type='submit' value='{{system.snippets.send_email}}' />
<img alt='Ajax-loader-small' id='email_submit_spinner' src='{{ "/images/ajax-loader-small.gif" | portal_image_url: image_asset_host }}' style='display: none; margin: 7px 0 0 5px; position: absolute;' />
</div>
{{form_end}}
</div>
</div>
</div>
<!--
***************
The following attribution needs to remain as is in terms of wording with the appropriate link back to desk.com as per our terms of service: http://www.desk.com/terms
If you would like, you may change the location or the styling to better match your site, but the content and the link must remain in the template and visible to end users.
****************
-->
<div id='footer'>
{{ desk.page.theme.footer_content }}
<br/>
<a href='http://www.Desk.com'>Customer service software</a> powered by Desk.com
</div>
</div>
<script type="text/javascript" src="{{desk_javascript_host}}portal/desk.portal.body.email_new.js"></script>
<script>
$(function() {
$(".category select").change(function() {
if ($(this).val() == "Order Status") {
$(".order-number").show();
} else {
$(".order-number").hide();
$(".order-number input").val("");
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment