Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript Conditional Fields (Zendesk Lotus)
    primarykey
    data
    text
    <p>I am trying to configure some javascript code to make a conditional field app in Zendesk Lotus. Below is the javascipt template and my current html. Could someone give me an example of how I would change the java template to suit my html? I would like to only show the second drop down form field (ticket_fields_21552756) when the option 'qa' is selected from the first drop down list (ticket_fields_21013678). Once someone shows me how to do this I will be able to do the rest myself :)</p> <p><strong>PS, the javascript must stay in the below format</strong>. </p> <p>Thanks in advance for the help!</p> <p><strong>Javascript:</strong></p> <pre><code> (function(){ var projectRequest = ['280865'], otherHelpesk = ['279466'], hideAll = [].concat(projectRequest, otherHelpesk), moodFieldMap = { cat:[].concat(projectRequest), dog:[].concat(otherHelpesk), dolphin: [].concat(projectRequest, otherHelpesk) }; return { appID: 'https://github.com/zendesk/widgets/tree/master/ConditionalFieldsApp', defaultState: 'loading', type2thing: '', events: { 'app.activated': 'setValue', 'ticket.custom_field_21631456.changed': 'typeII' }, //end events typeII: function(){ this.hide(hideAll); this.type2thing = this.ticket().customField('custom_field_21631456'); //console.log('control field value: ' + this.type2thing); if (this.type2thing != null) { this.show(moodFieldMap[this.type2thing]); } }, setValue: function() { //console.log('activated', arguments); this.typeII(); }, hide: function(fields){ fields.forEach(function(field) { this.ticketFields('custom_field_' + field).hide(); }, this); }, show: function(fields) { fields.forEach(function(field) { this.ticketFields('custom_field_' + field).show(); }, this); } }; }()); </code></pre> <p><strong>My HTML:</strong></p> <pre><code>&lt;select id="ticket_fields_21013678" name="ticket[fields][21013678]" tabindex="8"&gt;&lt;option value=""&gt;-&lt;/option&gt; &lt;option value="depreqaccount_management"&gt;Account Management&lt;/option&gt; &lt;option value="ce_vp"&gt;CE/VP&lt;/option&gt; &lt;option value="city_management"&gt;City Management&lt;/option&gt; &lt;option value="city_planning"&gt;City Planning&lt;/option&gt; &lt;option value="customer_service"&gt;Customer Service&lt;/option&gt; &lt;option value="depreq_images"&gt;Images&lt;/option&gt; &lt;option value="partner_management"&gt;Partner Management&lt;/option&gt; &lt;option value="production"&gt;Production&lt;/option&gt; &lt;option value="qa"&gt;QA&lt;/option&gt; &lt;option value="senior_management"&gt;Senior Management&lt;/option&gt; &lt;option value="depreq_writers"&gt;Writers&lt;/option&gt; &lt;option value="depreq_bdm"&gt;BDM&lt;/option&gt;&lt;/select&gt; &lt;select id="ticket_fields_21552756" name="ticket[fields][21552756]" tabindex="9"&gt;&lt;option value=""&gt;-&lt;/option&gt; &lt;option value="responsibility_account_manager"&gt;Account Manager&lt;/option&gt; &lt;option value="responsibility_bdm"&gt;BDM&lt;/option&gt; &lt;option value="responsibility_ce_vp"&gt;CE/VP&lt;/option&gt; &lt;option value="responsibility_city_manager"&gt;City Manager&lt;/option&gt; &lt;option value="responsibility_city_planner"&gt;City Planner&lt;/option&gt; &lt;option value="responsibility_customer_service"&gt;Customer Service&lt;/option&gt; &lt;option value="responsibility_image_designer"&gt;Images&lt;/option&gt; &lt;option value="responsibility_merchant"&gt;Merchant&lt;/option&gt; &lt;option value="responsibility_partner_manager"&gt;Partner Manager&lt;/option&gt; &lt;option value="responsibility_producer"&gt;Producer&lt;/option&gt; &lt;option value="responsibility_qa"&gt;QA&lt;/option&gt; &lt;option value="responsibility_writer"&gt;Writer&lt;/option&gt;&lt;/select&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload