<commit_before>define(['views/jqm/element'], function (ElementView) {
  'use strict';

  var ChoiceElementView = ElementView.extend({

    renderOtherText: function (render) {
      var self = this,
        name = this.model.attributes.name,
        $input = $('<input type="text" />'),
        $label = '<label rv-text="m:label" class="ui-input-text"></label>',
        $element = $('<div data-role="fieldcontain"></div>'),
        $div = $('<div class="ui-input-text"></div>'),
        isOtherRendered = !!this.$el.find('div[data-role=fieldcontain]').length,
        model = this.model;

      $element.addClass('ui-field-contain ui-body ui-br');
      $div.addClass('ui-shadow-inset ui-corner-all ui-btn-shadow ui-body-c');

      $input.attr({
        name: name + '_other',
        'class': 'ui-input-text ui-body-c'
      });
      if (render && !isOtherRendered) {
        $element.append($label);
        $div.append($input);
        $element.append($div);
        this.$el.append($element);
        $input.on('change', function () {
          var attr = model.attributes;
          attr.value = self.prepModelValue();
        });
      } else if (!render && isOtherRendered) {
        this.$el.children('div[data-role=fieldcontain]').remove();
      }
    },
    prepModelValue: function() {
      var $input = this.$el.find('input[type = text]'),
        values;
<commit_msg>FORMS-127 # select/multiselect: with `other` selected, properly validate field for required=true<commit_after>define(['views/jqm/element'], function (ElementView) {
  'use strict';

  var ChoiceElementView = ElementView.extend({

    renderOtherText: function (render) {
      var self = this,
        name = this.model.attributes.name,
        $input = $('<input type="text" />'),
        $label = '<label rv-text="m:label" class="ui-input-text"></label>',
        $element = $('<div data-role="fieldcontain"></div>'),
        $div = $('<div class="ui-input-text"></div>'),
        isOtherRendered = !!this.$el.find('div[data-role=fieldcontain]').length;

      $element.addClass('ui-field-contain ui-body ui-br');
      $div.addClass('ui-shadow-inset ui-corner-all ui-btn-shadow ui-body-c');

      $input.attr({
        name: name + '_other',
        'class': 'ui-input-text ui-body-c'
      });
      if (render && !isOtherRendered) {
        $element.append($label);
        $div.append($input);
        $element.append($div);
        this.$el.append($element);
        $input.on('change', function () {
          self.model.set('value', self.prepModelValue());
        });
      } else if (!render && isOtherRendered) {
        this.$el.children('div[data-role=fieldcontain]').remove();
      }
    },
    prepModelValue: function() {
      var $input = this.$el.find('input[type = text]'),
        values;

{'fraction_non_alphanumeric': 0.1897784131522516, 'fraction_numerical': 0.001072194424588992, 'mean_word_length': 2.682894736842105, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4800002', 'n_tokens_mistral': 883, 'n_tokens_neox': 866, 'n_words': 150}