#include "CDXDBE.CH" #include "COLLAT.CH" #include "COMMON.CH" #include "DBFDBE.CH" #include "DBSTRUCT.CH" #include "DLL.CH" #include "DMLB.CH" #include "ERROR.CH" #include "FILEIO.CH" #include "FONT.CH" #include "FOXDBE.CH" #include "INKEY.CH" #define CRLF chr(13)+chr(10) FUNCTION _register( oPackage ) LOCAL oDlg LOCAL oList LOCAL oStat LOCAL oStat2 oPackage:registerForm( "INTRO_TESTAJAX" ) oPackage:registerForm( "STUFF_CUSTOMER" ) oPackage:registerForm( "STUFF_PRODUCT" ) oPackage:registerForm( "NOTDEF" ) oPackage:registerForm( "SAVE_TESTAJAX" ) RETURN .T. FUNCTION _version() RETURN "Version 2.5" FUNCTION _Copyright() RETURN "Graphical Database Programs, (c) 2008. All rights reserved." FUNCTION INTRO_TESTAJAX( oHtml, oContext ) LOCAL aCountries := { "", "England", "France", "Germany", "USA" } LOCAL n LOCAL cId LOCAL cValue oHtml:put( strtran( doctype(), "$1$", procname())) oHtml:put([]) oHtml:put([]) oHtml:put([]) oHtml:put([
]) oHtml:put([ ]) oHtml:put([]) // country select oHtml:put([
]) oHtml:put([Pick a Country ]) oHtml:put([]) oHtml:put([
]) // customer select oHtml:put([
]) oHtml:put([

Customer Select will display here...

]) oHtml:put([
]) // product select oHtml:put([
]) oHtml:put([

Product Select will display here...

]) oHtml:put([
]) oHtml:put([
]) oHtml:put([]) oHtml:put([
]) oHtml:put([]) oHtml:put([]) return (.T.) FUNCTION STUFF_CUSTOMER( oHtml, oContext ) // this is the function called by Ajax.Updater LOCAL aCustomers LOCAL cCountry LOCAL cId LOCAL cValue LOCAL n cCountry := oHtml:getVar("COUNTRY" ) aCustomers := { "AACME", "BACME", "CACME", "DACME"} oHtml:put([Now, pick a Customer from ] + cCountry + [ ]) oHtml:put([]) return (.T.) FUNCTION STUFF_PRODUCT( oHtml, oContext ) // this is the function called by Ajax.Updater LOCAL aProducts LOCAL cCustomer LOCAL cId LOCAL cValue LOCAL n cCustomer := oHtml:getVar("CUSTOMER" ) aProducts := { "AWIDGET", "BWIDGET", "CWIDGET", "DWIDGET"} oHtml:put([Now, pick a Product for ] + cCustomer + [ ]) oHtml:put([]) return (.T.) FUNCTION NOTDEF( oHtml, oContext ) oHtml:put([

Product Select will display here...

]) return (.T.) FUNCTION SAVE_TESTAJAX( oHtml, oContext ) LOCAL aValues LOCAL n LOCAL cField LOCAL cValue oHtml:put( strtran( doctype(), "$1$", procname())) oHtml:put([]) oHtml:put([]) aValues := oHtml:getAllVars() // each element of aValues is { "var name", {array of var values} } for n := 1 to len( aValues ) cField := aValues[n][1] cValue := aValues[n][2][1] oHtml:put([

] + cField + " = " + cValue + [

]) next oHtml:put([]) oHtml:put([]) return (.T.) FUNCTION DOCTYPE() return ([] + CRLF + ; [] + CRLF + ; [] + CRLF + ; [] + CRLF + ; [$1$] + CRLF + ; [] + CRLF + ; [] + CRLF + ; [] + CRLF )