Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-138] inputs inside alertdialogs

GitHub Issuen/a
Resolution Date2011-04-15T02:24:13.000+0000
Affected Version/sn/a
Fix Version/sn/a
ReporterKevin Holland
AssigneeReggie Seagraves


I came across something else i use in my obj-c apps that I cant seem to find any documentation about doing with titanium. Input fields inside an alert. I use it for a account register dialog (much easier and imo smoother progression).

here an example of how its done in objective c

UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Register Account" message: @"" delegate: self cancelButtonTitle: @"Nevermind" otherButtonTitles: @"Register!", nil];
[alert addTextFieldWithValue: @"" label: @"Email"];
[alert addTextFieldWithValue: @"" label: @"Password"];
[alert addTextFieldWithValue: @"" label: @"Password Confirm"];

emailField = [alert textFieldAtIndex:0];
emailField.keyboardType = UIKeyboardTypeAlphabet;
emailField.keyboardAppearance = UIKeyboardAppearanceAlert;
emailField.autocorrectionType = UITextAutocorrectionTypeNo;
emailField.autocapitalizationType = UITextAutocapitalizationTypeNone;
passwordField = [alert textFieldAtIndex:1];
passwordField.clearButtonMode = UITextFieldViewModeWhileEditing;
passwordField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
passwordField.keyboardAppearance = UIKeyboardAppearanceAlert;
passwordField.autocorrectionType = UITextAutocorrectionTypeNo;
passwordField.secureTextEntry = YES;

passwordField2 = [alert textFieldAtIndex:2];
passwordField2.clearButtonMode = UITextFieldViewModeWhileEditing;
passwordField2.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
passwordField2.keyboardAppearance = UIKeyboardAppearanceAlert;
passwordField2.autocorrectionType = UITextAutocorrectionTypeNo;
passwordField2.secureTextEntry = YES;

[alert show];
[alert release];

any chance we might see this in the future as well?




  1. Blain Hamon 2011-04-15

    Part of the problem is that the -[UIAlertView addTextFieldWithValue:label:] and -[UIAlert textFieldAtIndex:] are currently undocumented/private APIs, and the use of it could result in App Store rejections. There's another trick that's just as hairy which involves blindly stabbing UITextFields into the view that is UIAlertView.

  2. Kevin Holland 2011-04-15

    That's unfortunate. I've seen apps on the appstore that employ this method, but you know how crappy apples policies are... they could get pulled tomorrow, or never. :(

  3. Blain Hamon 2011-04-15

    Tell me about it. My 'favorite' is when you release 2.0, which has x new feature and gets approved, then you do an important bugfix to 2.0.1, and it's rejected for the x which was in 2.0. Given the trouble Apple gave PhoneGap early on, Titanium was designed to stay as safely inside the lines as possible.

    The Apple guidelines themselves say, 'don't put text fields in alerts, use modal fullscreen pages for it'. The fact that Apple themselves do it (Safari and app store) and have such a nice interface for it makes this even more annoying.

    In the mean time, the solution is to create a window with a web view with the text fields and buttons, and have window.open({modal:true}) so the window is brought up from the bottom. It's not as pretty, but it's kosher and it's here now.

    --Edit: My bad. I can't recall, but I think the {modal:true} functionality is coming out in 0.7.

  4. Blain Hamon 2011-04-15

    No longer holding breath for Apple to share their toys with others. Until they do, we might as well close this one. Since it was never resolved, it'll have to be marked invalid.

  5. Sj101 2011-04-15

    This is really something I been wishing for a long long time. Any way someone can make this thing as a module so its optional? I want to test it with an app and see if it gets rejected!

  6. Sj101 2011-04-15

    This is really something I been wishing for a long long time. Any way someone can make this thing as a module so its optional? I want to test it with an app and see if it gets rejected!

  7. Lee Morris 2017-03-09

    Closing ticket as invalid.

JSON Source