[TIMOB-20024] iOS: Support setting values for Ti.UI.AlertDialog input fields
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2017-05-11T17:05:15.000+0000 |
| Affected Version/s | Release 5.1.0 |
| Fix Version/s | Release 6.1.0 |
| Components | iOS |
| Labels | Crown |
| Reporter | Fokke Zandbergen |
| Assignee | Hans Knöchel |
| Created | 2015-11-20T10:27:36.000+0000 |
| Updated | 2017-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.
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();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.