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; } });
Your Answer
Think you can help? Login to answer this question!