Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20024] iOS: Support setting values for Ti.UI.AlertDialog input fields

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2017-05-11T17:05:15.000+0000
Affected Version/sRelease 5.1.0
Fix Version/sRelease 6.1.0
ComponentsiOS
LabelsCrown
ReporterFokke Zandbergen
AssigneeHans Knöchel
Created2015-11-20T10:27:36.000+0000
Updated2017-05-12T04:33:39.000+0000

Description

I'd like to pre-set the values for the new [Ti.UI.AlertDialog](https://appcelerator.github.io/appc-docs/latest/#!/api/Titanium.UI.AlertDialog) input fields. * value to set/get the value for PLAIN_TEXT_INPUT and SECURE_TEXT_INPUT * loginValue to set/get the login value for LOGIN_AND_PASSWORD_INPUT * passwordValue to set/get the password value for LOGIN_AND_PASSWORD_INPUT The use case it to allow the user to change an existing setting in an app or press _Cancel_ if he sees it's OK already.

Comments

  1. Hans Knöchel 2017-05-10

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/9046 PR (6_1_X): https://github.com/appcelerator/titanium_mobile/pull/9047 Test-Case:
       var win = Ti.UI.createWindow({
           backgroundColor: '#fff'
       });
       
       var btn1 = Ti.UI.createButton({
           title: 'Show Single Input Dialog',
           top: 80
       });
       
       btn1.addEventListener('click', function() {
           var dialog = Ti.UI.createAlertDialog({
               title: 'Test Single Input',
               message: 'Looks Good?',
               buttonNames: ['OK'],    
               style: Ti.UI.iOS.AlertDialogStyle.PLAIN_TEXT_INPUT,
               
               // NEW
               value: 'Enter Value ...',
           });
           
           dialog.show();
       });
       
       var btn2 = Ti.UI.createButton({
           title: 'Show Single Input Dialog',
           top: 160
       });
       
       btn2.addEventListener('click', function() {
           var dialog = Ti.UI.createAlertDialog({
               title: 'Test Login / Password Input',
               message: 'Looks Good?',
               buttonNames: ['OK'],       
               style: Ti.UI.iOS.AlertDialogStyle.LOGIN_AND_PASSWORD_INPUT,
       
               // NEW
               loginValue: 'Hans',
               passwordValue: 's3cr3t_p4ssw0r4', // Will be ****** anyway
           });
           
           dialog.show();
       });
       
       win.add(btn1);
       win.add(btn2);
       
       win.open();
       
  2. Abir Mukherjee 2017-05-11

    Passed FR with this environment: Node Version: 6.10.1 NPM Version: 3.10.10 Mac OS: 10.12.4 Appc CLI: 6.2.0 Appc CLI NPM: 4.2.9 Titanium SDK version: 6.2.0 from this PR Appcelerator Studio, build: 4.8.1.201612050850 Xcode 8.3.2 Fixes were seen in the latest SDK 6.1.0 and 6.2.0 builds. Closing ticket. I built an iOS app to device using the testcase from Han's comments above. I pressed on both buttons, and the forms were prefilled. I found that I had a choice to either edit the data in the fields or I can hit the "OK" button if I accepted the pre-filled data.

JSON Source