Changes to the ajax function in order to obtain the list of variables

This commit is contained in:
user
2012-11-23 16:54:38 -04:00
parent 209cdfbed7
commit adb1ae1c34
3 changed files with 22 additions and 21 deletions

View File

@@ -4,20 +4,17 @@ var getValue = function (list) {
var getVariableList = function (queryText, proUid, varType){
varType = varType.toLowerCase();
var response
var responseData
var oRPC = new leimnud.module.rpc.xmlhttp({
url : "../processes/processes_Ajax",
async : false,
method: "POST",
args : "action=getVariableList&process="+proUid+"&queryText="+queryText+"&type="+varType
});
oRPC.callback = function(rpc){
console.log(rpc.xmlhttp.responseText);
response = eval(rpc.xmlhttp.responseText);
}.extend(this);
oRPC.make();
console.log(response);
responseData = eval ("(" +oRPC.xmlhttp.responseText+ ")");
return responseData;
}
leimnud.event.add(document.getElementById('type_variables'), 'change', function(event) {
@@ -29,16 +26,20 @@ leimnud.event.add(document.getElementById('prefix'), 'change', function(event) {
});
leimnud.event.add(document.getElementById('search'), 'keypress', function(event) {
var tecla = event.keyCode;
if(tecla == '13')
leimnud.event.add(document.getElementById('search'), 'keypress', function(e) {
var key = e.keyCode;
if(key == '13')
{
var list = getVariableList('nuev','2527075735085b447a58523099748463','system');
console.log(list);
for (var i in list){
console.log(list[i]);
for (var i=0; i< list.length; i++){
console.log(list[i].sName);
}
e.cancelBubble = true;
e.returnValue = false;
if (e.stopPropagation) {
e.stopPropagation();
e.preventDefault();
}
console.log('Has pulsado enter');
return false;
}
});

View File

@@ -71,8 +71,7 @@ $html .= '<option value="ID_REPLACE_WITHOUT_CHANGES">@=</option>';
$html .= '</select> &nbsp;&nbsp;&nbsp;&nbsp;';
$html .= '</td>';
$html .= '<td width="20%">';
//$html .= '<input type="text" id="search" size="15" onkeydown="validartexto(event);">';
$html .= '<td width="20%" valign="top">';
$html .= '<input type="text" id="search" size="15">';
$html .= '</td>';
$html .= '</tr>';

View File

@@ -522,16 +522,17 @@ try {
case 'getVariableList':
G::LoadClass( 'xmlfield_InputPM' );
$proUid= isset($_REQUEST['process'])?$_REQUEST['process']:'';
$queryText= isset($_REQUEST['queryText'])?$_REQUEST['queryText']:'';
$aFields = getDynaformsVars( $proUid, true, isset( $_REQUEST['bIncMulSelFields'] ) ? $_REQUEST['bIncMulSelFields'] : 0 );
$_REQUEST['queryString'] = 'SYS';
//$_REQUEST['queryString'] = 'SYS';
$aVariables = array();
foreach ($aFields as $key => $value) {
if(stristr($aFields[$key]['sName'], $_REQUEST['queryString'])){
if(stristr($aFields[$key]['sName'], $queryText)){
$aVariables[] = $aFields[$key];
}
}
$oJSON = new Services_JSON();
echo $oJSON->encode($aFields);
echo $oJSON->encode($aVariables);
break;
/*
case 'saveFile':