Monday, November 26, 2018

Over basic widget from get value and doreset it


var arrlist =[];
var OnSelecteddate = false;
function validte(rsponse){

  if(rsponse === null || rsponse === "" || rsponse ===" "|| rsponse === undefined){
    return true;
  }else{
    return false;
  }
}
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();
   
    //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;
}


function onSelection(evenobj){
  frmDetailofRegistor.lblADOB.text = evenobj.day + "/" + evenobj.month + "/" +evenobj.year;
  OnSelecteddate = true;
}

function imgFetchMedia(){
  var querycontext = {mimetype:"image/*"};
  var Status = kony.phone.openMediaGallery(onselectioncallback, querycontext);

  function onselectioncallback(rawBytes)
  {


    if (rawBytes === null){
      alert("please select images");
    }else{
      var base64Str = kony.convertToBase64(rawBytes);
      frmRegistor.imageshow.base64 = base64Str;

      frmDetailofRegistor.imageofuser.base64 = base64Str; 
    }

  }
}
function img(){
  var rawbytes = frmRegistor.cameraid.rawBytes;
  var base64Str = kony.convertToBase64(rawbytes);
  frmRegistor.imageshow.base64 = base64Str;
  frmDetailofRegistor.imageofuser.base64 = base64Str; 
}

function doresetR(){

  frmRegistor.imageshow.src="";
  frmRegistor.txtName.text ="";
  frmRegistor.txtPW.text ="";
  frmRegistor.txtCPW.text ="";
  frmRegistor.txABOX.text="";
  frmRegistor.lstBox.selectedKey = "Wish0";
  frmRegistor.rbtGender.selectedKey ="rbg1";
  frmRegistor.sldbox.selectedValue ="0";
  frmRegistor.CHKBox.selectedKeys = [""];
   var currentdate = new Date();
  frmRegistor.calBox.dateComponents = currentdate.getDate() +"/"+ currentdate.getMonth() +"/"+ currentdate.getFullYear();
  frmRegistor.btnswitch.selectedIndex = 0.0;
  frmRegistor.txtName.setFocus(true);
  return false;
}

0 comments:

Post a Comment