
Runner.pages.fieldsEvents["ask_password2"]=function(pageObj,pageid,row){if(row){row=new Runner.AjaxRow(pageObj,row);}
var ret,reqParams,ctrl=this,fieldsData={},params={},ajax=new Runner.form.Button({id:'ask_password2',btnName:'ask_password2'}),before=function(){var password=prompt('Enter a password');$.post("",{a:"check_password",password:password},function(response){var result=JSON.parse(response);if(!result.success){alert("Incorrect password");ctrl.setValue(ctrl.defaultValue);}});return false;},after=function(result){},submit=function(){params["table"]="buyers";params["field"]=ctrl.fieldName;(Runner.controls.ControlStorage.byId(pageid)||[]).forEach(function(ctrl){if(!(ctrl instanceof Runner.controls.MultiUploadField)&&!(ctrl instanceof Runner.controls.FileControl)){fieldsData[ctrl.fieldName]=ctrl.getStringValue();}});reqParams={params:JSON.stringify(params),event:"ask_password2",pageType:pageObj.pageType,keys:JSON.stringify(pageObj.keys?pageObj.keys:(row&&row.getKeys())),masterTable:pageObj.masterTable,fieldsData:JSON.stringify(fieldsData)};$.post(Runner.getPageUrl("buttonhandler"),reqParams,function(result){var _result;try{_result=JSON.parse(result);}catch(e){Runner.displayGenericAjaxError(result);}
after.call(ctrl,_result);}).fail(function(jqXHR,textStatus,errorThrown){Runner.displayGenericAjaxError(jqXHR.responseText||textStatus+' '+errorThrown);});submit=function(){};};ajax.submitHandler=submit;ajax.submit=submit;ret=before.call(this);if(ret===false){return;}
submit();};