Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8808003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:30:37+00:00 2026-06-14T02:30:37+00:00

I do the following When I tap on text field, I show a picker,

  • 0

I do the following

When I tap on text field, I show a picker, and I change the background image of the text field.

When the person is done with the picker (they click “done”), and I change the text field background back to white.

When I click on the text field again, the background image does not get changed even though the picker appears.

What can I do? I want it so that the text field keeps getting changed to a green background whenever I click on it and the picker shows up. And then changes back to white when I tap out of it and the picker disappears.

tf1.addEventListener('focus', function(e) {
    Titanium.API.info('Triggered focus on date txtField');

    tf1.setBackgroundImage('../images/selected.gif');

    Titanium.API.info(tf1.backgroundImage);

    var winDatePicker1 = Titanium.UI.currentWindow;

    var minDate = new Date();
    minDate.getFullYear();
    minDate.getMonth();
    minDate.getDate();

    var maxDate = new Date();
    maxDate.setFullYear(2018);
    maxDate.setMonth(9);
    maxDate.setDate(30);

    var datePicker = Ti.UI.createPicker({
        type : Ti.UI.PICKER_TYPE_DATE_AND_TIME,
        minDate : minDate,
        maxDate : maxDate,
        bottom : 0,
        minuteInterval : 10
    });

    var tview = Ti.UI.createView({
        height : '100%',
        width : '100%',
        top : 0,
        backgroundColor : 'transparent'
    });

    var done1 = Ti.UI.createImageView({
        title : '',
        width : 80,
        right : 12,
        height : 40,
        image : '../images/done.gif',
    });

    var toolbar1 = Ti.UI.createView({
        height : 43,
        backgroundImage : '../images/toolbar.gif',
    });

    toolbar1.add(done1);

    done1.addEventListener('click', function() {
        tf1.backgroundImage = '';
        toolbar1.hide();
        datePicker.hide();
        tview.hide();
    });

    tview.addEventListener('click', function() {
        toolbar1.hide();
        datePicker.hide();
        tview.hide();
    });

    // turn on the selection indicator (off by default)
    datePicker.selectionIndicator = true;

    datePicker.addEventListener('change', function(e) {

        Titanium.API.info('E value = ' + e.value);

        var pickerDate = e.value;

        var day = pickerDate.getDate();
        day = day.toString();

        if (day.length < 2) {
            day = '0' + day;
        }

        var month = pickerDate.getMonth();
        month = month + 1;
        month = month.toString();

        if (month.length < 2) {
            month = '0' + month;
        }

        var year = pickerDate.getFullYear();
        var hr = pickerDate.getHours();
        var min = pickerDate.getMinutes();

        if (hr < 10) {
            hr = '0' + hr;
        }

        if (min < 10) {
            min = '0' + min;
        }

        var datestr = '';

        if (hr >= 12) 
        {
            datestr += ' ' + (hr == 12 ? hr : hr - 12) + ':' + min + ' PM';
        } else {
            datestr += ' ' + hr + ':' + min + ' AM';
        }

        var newdate = month + "/" + day + "/" + year + datestr;

        Titanium.API.info('converted value = ' + newdate);

        tf1.setValue(newdate);

    });

    tview.add(datePicker);
    tview.add(toolbar1);

    winDatePicker1.add(tview);

    winDatePicker1.show({
        view : tf1,
        animated : true
    });

});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T02:30:38+00:00Added an answer on June 14, 2026 at 2:30 am
    make setVisible(true) or setVisible(false)
    
    show() and hide() will not give proper toggle at some conditions.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have customized UIButton with the following properties: 84x44 frame 84x44 background image 32*32
How to change the following method to use tap to stop the warnings like
I have placed following javascript in my html file. <script TYPE=text/javascript> function srk(){ document.ontouchmove
When I try to install tap using npm install tap I get the following
I think the following image can describe the problem pretty well... https://www.dropbox.com/s/pd1syth3gce6qh7/ios_uimenucontroller.png I also
I need to toast something on double tap the screen. I tried the following
I am following Apple's WWDC 2010 video on TVAnimationGestures (Advanced Table Views). They expand
Using OS 3.1 I'm placing a tap-detecting image view (taken from Apple's Scroll View
The following is from documentation : Although taps are discrete gestures, they are discrete
I have the following two 8-tap filters: h0 ['-0.010597', '0.032883', '0.030841', '-0.187035', '-0.027984', '0.630881',

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.