Login   Register  
PHP Classes
elePHPant
Icontem

File: View.html

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of adscript  >  DABAJAX Toolkit  >  View.html  >  Download  
File: View.html
Role: Auxiliary data
Content type: text/plain
Description: view mode
Class: DABAJAX Toolkit
Auto-complete fields with Oracle database data
Author: By
Last change: it were using wrong script
Date: 4 years ago
Size: 2,221 bytes
 

Contents

Class file image Download
<html>
<head>
   <style type="text/css" rel="stylesheet">
      div {
         border-style:solid;
         border-width:1px;
         border-color:black;
      }
   </style>
   
	<script LANGUAGE="JavaScript" src="js/tkajax.js" type="text/javascript" ></script>
	<script LANGUAGE="JavaScript" src="js/JSON.js" type="text/javascript"></script>
	<script language="javascript">

	function teste() {

		if ( document.getElementById( 'id_contato' ).value.length == 0 ) return;
			   
	   _ajaxobject = new TKAjax();      
	   _ajaxfilter = new AjaxFilter();
	   	  
	   // md5 query
	   sql = "1:afe8133bd534f4a04e1222c913b735f7"; 
	   
	   _ajaxfilter.addFilter( "id_contato", document.getElementById( 'id_contato' ).value, _ajaxfilter.NUMERIC );
	   _ajaxfilter.addResult( "nm_contato" );
	   _ajaxfilter.addResult( "telefone" );
	   _ajaxfilter.setSql( sql );

      _ajaxobject.setJSONData( _ajaxfilter );
      _ajaxobject.setServerScript( "Controller.php" );
      
      // setting the global callbackresult variable to customized requestListener function
      // which will be used by AjaxResultManager
      _ajaxcallbackresult = requestListener;
      
      // object to treat callback result manager
      result = new AjaxResultManager();
      
      _ajaxobject.setProcessReq( result.getCallback() );
      _ajaxobject.sendDataToServer( 'cd_terceiro=9999' );
       
	};

	function requestListener() {
	   
 	   if ( _ajaxresultjsontext[ 0 ] == "error" ) {
	      alert( _ajaxresultjsontext[ 1 ] );

         // ajaxfilter created at function sendRequest
	      res = _ajaxfilter.getResults();
	      
	      for ( i = 0; i < res.length; i++ ) {
	         document.getElementById( res[ i ] ).value = "";
	      }
	      
	      return;
  	   }
	
		var i = 0;
		res = _ajaxfilter.getResults();
		for ( i = 0; i < res.length; i++ ) {
		   document.getElementById( res[ i ] ).value = _ajaxresultjsontext[ i ];
		}
	}
	
	</script>	
</head>

<body>

<div>codigo:<input type="text" id="id_contato" name="id_contato" onblur="javascript:teste();"><br>
    nome:<input type="text" id="nm_contato" name="nm_contato"><br>
    telefone:<input type="text" id="telefone" name="telefone"><br>
</div>

<br>

</body>

</html>