Picker

You must Login before you can answer or comment on any questions.

I created a form that has four separate pickers, which the values will be provided by the users through a remote file, the pickers are Teacher, Email, Grade....

I get all the data across, how can I set/write the code so if the teacher selects one picker the rest of them will be populated automatically without they selecting them one by one.

Thanks in advance.

2 Answers

Hi Shahrokh,

Attach a "change" event to each picker: pickerName.addEventListener('change', function(e) { // code to be executed when user updates the picker value });

Regards!

Hi, Try this code, this will give u idea...

var picker = Ti.UI.createPicker();
 
var data = [];
data[0]=Ti.UI.createPickerRow({title:'1'});
data[1]=Ti.UI.createPickerRow({title:'2',custom_item:'s'});
data[2]=Ti.UI.createPickerRow({title:'3',custom_item:'m'});
data[3]=Ti.UI.createPickerRow({title:'4',custom_item:'g'});
 
// turn on the selection indicator (off by default)
picker.selectionIndicator = true;
 
picker.add(data);
 
win.add(picker);
 
picker.addEventListener('change', function(e) {
    var val = e.row.title;
 
    switch(val) {
        case "1":
            label.text = "Hi I am One";
            break;
        case "2":
            label.text = "Hi I am Two";
            break;
        case "3":
            label.text = "Hi I am Three";
            break;
        case "4":
            label.text = "Hi I am Four";
            break;
    }
});

— answered 11 months ago by Moiz Chhatriwala
answer permalink
1 Comment
  • Thanks for you comments, the users list (on average about 50 users) will be supplied by schools which contain teachers name, email, grade and all have their own picker and will be displayed on their own so they don't have to type them in, I'm trying to create a searchable pickers if you like, so when they select name picker,the rest will be filled out, like a loop or if statement to go through the list and link the details to that particular user, keep in mind the data will be dynamic and will be different for each schools. Thanks again.

    — commented 11 months ago by Shahrokh Mortezapour

Your Answer

Think you can help? Login to answer this question!