Monday, November 26, 2018

Fetch data from basic widget and show it on Segment

Call it while Submit form button:
function OnValidateDetail(){
  if(kony.store.getItem("AUDetails") !== null){
    arrlist = kony.store.getItem("AUDetails");
  }
  if(validte(frmRegistor.txtName.text)){
    alert("Please enter username");
    frmRegistor.txtName.setFocus(true);
    return false;
  }
  if(validte(frmRegistor.txtPW.text)){
    alert("Please enter password");
    frmRegistor.txtPW.setFocus(true);
    return false;
  }
  if(validte(frmRegistor.txtCPW.text)){
    alert("Please enter confirm password");
    frmRegistor.txtCPW.setFocus(true);
    return false;
  }
  if(frmRegistor.txtPW.text !== frmRegistor.txtCPW.text){
    alert("Please check confirm password");
    frmRegistor.txtCPW.setFocus(true);
    return false;
  }

  if(validte(frmRegistor.rbtGender.selectedKeyValue)){
    alert("Please select gender");
    frmRegistor.rbtGender.setFocus(true);
    return false;
  }

  if(OnSelecteddate === false){
    var currentdate = new Date();
    frmDetailofRegistor.lblADOB.text = currentdate.getDate() +"/"+ currentdate.getMonth() +"/"+ currentdate.getFullYear();
    //OnSelecteddate = true;
  }
  if(validte(frmRegistor.txABOX.text)){
    alert("Please select address");
    frmRegistor.txABOX.setFocus(true);
    return false;
  }

  var a = "";
  if(frmRegistor.CHKBox.selectedKeyValues !== null){
    for(var i = 0; i< frmRegistor.CHKBox.selectedKeyValues.length; i++){
      if(a.length >0){
        a += "/";
      }
      a += frmRegistor.CHKBox.selectedKeyValues[i][1];
    }
  }else if(frmRegistor.CHKBox.selectedKeyValues === null){
    alert("Please select Skill");
    return false;
  }
  if(validte(frmRegistor.rchtxtBox.text)){
    alert("Please enter richtext");
    frmRegistor.rchtxtBox.setFocus(true);
    return false;
  }
  if(frmRegistor.lstBox.selectedKey === "Wish0"){
    alert("Please select option");
    frmRegistor.lstBox.setFocus(true);
    return false;
  }
  if(frmRegistor.sldbox.selectedValue === "0"){
    alert("Please give rating 0 above");
    frmRegistor.sldbox.setFocus(true);
    return false;
  }
  if(validte(frmRegistor.pckrDate.selectedKeyValues[2][1])){
    alert("Please select rating above of zero");
    frmRegistor.pckrDate.setFocus(true);
    return false;
  }
  if(validte(frmRegistor.imageshow.base64)){
    alert("Please Update profile picture");
    return false;
  }
  frmDetailofRegistor.lblNAME.text = frmRegistor.txtName.text;
  frmDetailofRegistor.lblgender.text = frmRegistor.rbtGender.selectedKeyValue[1];
  frmDetailofRegistor.lbladr.text = frmRegistor.txABOX.text;
  frmDetailofRegistor.lblSkills.text = a;
  frmDetailofRegistor.txtrichConvert.text =frmRegistor.rchtxtBox.text;
  frmDetailofRegistor.lblOption.text = frmRegistor.lstBox.selectedKeyValue[1];
  frmDetailofRegistor.lblrating.text = frmRegistor.sldbox.selectedValue;
  if(frmRegistor.btnswitch.selectedIndex === 0.0){
    frmDetailofRegistor.lblWilling.text = "Willing";

  }else{
    frmDetailofRegistor.lblWilling.text = "Not Willing";
  }
  frmDetailofRegistor.lblEntryDate.text = frmRegistor.pckrDate.selectedKeyValues[2][1] +"/"+ frmRegistor.pckrDate.selectedKeyValues[1][1] +"/"+ frmRegistor.pckrDate.selectedKeyValues[0][1];

  var obj ={ "Uimg":frmRegistor.imageshow.base64,"Uname":frmRegistor.txtName.text,"Upw":frmRegistor.txtPW.text,
            "Ucpw":frmRegistor.txtCPW.text,"Ugender":frmRegistor.rbtGender.selectedKeyValue[1],"Udob":frmDetailofRegistor.lblADOB.text,
            "Uaddress":frmRegistor.txABOX.text,"Uskills":a,"Urichtext":frmRegistor.rchtxtBox.text,
            "Uoption":  frmRegistor.lstBox.selectedKeyValue[1],"Urating":frmRegistor.sldbox.selectedValue,"Uwilling":frmDetailofRegistor.lblWilling.text,
            "Uentrydate":frmRegistor.pckrDate.selectedKeyValues[2][1] +"/"+ frmRegistor.pckrDate.selectedKeyValues[1][1] +"/"+ frmRegistor.pckrDate.selectedKeyValues[0][1],
            "IsActive":false};
  arrlist.push(obj);
  kony.store.setItem("AUDetails", arrlist);
  frmLogin.show();
  return false;
}

0 comments:

Post a Comment