Timoor Kurdi
Timoor Kurdi

Reputation: 75

How to capture the value for one of the custom ticket fields in zendesk on the new request page?

In Zendesk's help center, I have a new request page set up which allows the end-user to submit a request.

For one of the questions, there is a dropdown which asks the client to establish whether they are using the basic or enterprise version.

If basic, I would like to display some text, perhaps a modal that has messaging around the prioritization for our customers.

However looking at the code, it isn't apparent how to capture the value from the dropdown to display the messaging accordingly.

So far I didn't see a clear way to accomplish this, I've been looking at the documentation here https://developer.zendesk.com/apps/docs/help-center-templates/new_request_page#content

This is the code that's set up on the New Request Page template.

{{breadcrumbs}}

<div class="clearfix">

  <section class="main-column">
   <h1>{{t 'submit_a_request'}}{{#if parent}}
    <span class="follow-up-hint">
      {{follow_up}}
    </span>
   {{/if}}</h1>

  <div class="form">
    {{request_form}}
  </div>
 </section>

{{chat}}

Upvotes: 3

Views: 1062

Answers (1)

Polar
Polar

Reputation: 124

You will want to grab the selected value with something like this (using jQuery for simplicity):

$('#request_custom_fields_' + custom_field_id).attr('value');

You can inspect the DOM to see the id. The resulting value will be the tag name you have assigned to the selected value of the custom field.

You can grab it on change and react to it with something like:

$('#request_custom_fields_' + custom_field_id).change(function(){
  if ($(this).attr('value') == 'my_cool_tag_value') {
  //Do your stuff
  }
});

Upvotes: 1

Related Questions