-1

How can we get the selected picker value in controller and do the validation of the selected value.

View:

  <Picker id="countryPicker" class="picker">
            <PickerRow title="Select a Country"/>
            <PickerRow title="India"/>
            <PickerRow title="China"/>
  </Picker>

Controller:

var countryname = $countryPicker.value();
alert("country: "+ countryname);
$.planWin.open();

Did validation done in controller or some other module?

Vinod
  • 2,263
  • 9
  • 55
  • 104
  • value is a property not a function ! and what does mean validation ? you have to explain more... – LHIOUI Sep 26 '14 at 15:28
  • I tried $countryPicker.value, for this also I'm not able to get the selected value. Validation mean not validation whether the value is selected for the question or not? – Vinod Sep 26 '14 at 15:32

1 Answers1

1

Put an event listener for change event fired when selecting a picker item ...

$.countryPicker.addEventListener('change',function(e){
 //do your stuff here 
});

on change event you can access selected item using event object (e) :

e.column, e.rowIndex, ...

refer to the official docs fro more information and use cases ...

LHIOUI
  • 3,287
  • 2
  • 24
  • 37