Titanium JIRA Archive
Appcelerator Community (AC)

[AC-4938] Support "maxLength" property for TextField inside AlertDialog

GitHub Issuen/a
TypeImprovement
Priorityn/a
StatusResolved
ResolutionWon't Fix
Resolution Date2017-05-05T13:17:24.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterKevin Southworth
AssigneeShak Hossain
Created2017-05-03T14:52:59.000+0000
Updated2018-08-14T14:00:09.000+0000

Description

Add support for the "maxLength" property of the TextField shown inside the AlertDialog when AlertDialog style is set to Titanium.UI.iOS.AlertDialogStyle.PLAIN_TEXT_INPUT

Comments

  1. Sharif AbuDarda 2017-05-03

    Hello, Can you share the native docs on this?
  2. Hans Knöchel 2017-05-05

    This is no native behavior and therefore we can not support it in the Core. You could just validate the input in your change event, like this:
       myField.addEventListener('change', function(e) {
         const maxLength = 10;
       
         if (e.value.length > maxLength) {
           this.value = this.value.substr(0, maxLength);
         }
       });
       
  3. Kanmani Raja 2018-08-14

    Hello Hans, Could you tell me how to access the TextField? I don't see an id attached to the text field. We need an id to attach a change event listener. Thanks,

JSON Source