Skip to content

Commit

Permalink
OC-13441Form Designer should autopopulate item name only to max length
Browse files Browse the repository at this point in the history
  • Loading branch information
gushil committed Dec 10, 2020
1 parent 5b76a7a commit f27670a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions jsapp/xlform/src/model.survey.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ module.exports = do ->
else
@_ensure_row_list_is_copied(row)
name_detail = row.get('name')
console.log 'deduplicate insertSurvey insert a question'
name_detail.set 'value', name_detail.deduplicate(@)
name_detail.set 'value', name_detail.deduplicate(@, @rowItemNameMaxLength)
target.rows.add(
row.toJSON(),
at: index_incr
Expand Down
5 changes: 5 additions & 0 deletions jsapp/xlform/src/view.rowDetail.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,11 @@ module.exports = do ->
@fieldMaxLength = 36
@fieldTab = "active"
@$el.addClass("card__settings__fields--#{@fieldTab}")
@model.set 'value', (@model.deduplicate @model.getSurvey(), @model.getSurvey().rowItemNameMaxLength)
rowItemNameMaxLength = @model.getSurvey().rowItemNameMaxLength
model_value = @model.get 'value'
if (@model.get('value').length > rowItemNameMaxLength) and (model_value.charAt(model_value.length - 4) != '_')
@model.set 'value', @model.get('value').slice(0, rowItemNameMaxLength)
if @model._parent.constructor.key == 'group'
viewRowDetail.Templates.textbox @cid, @model.key, _t("Layout Group Name"), 'text', 'Enter layout group name'
else
Expand Down

0 comments on commit f27670a

Please sign in to comment.