Alaska Software Inc. - Re: News from Alaska Software
Username: Password:
AuthorTopic: Re: News from Alaska Software
Thomas Braun
Re: News from Alaska Software
on Wed, 18 Feb 2009 13:16:55 +0100
Bruce Anderson wrote:

> Regarding the "WAA form-functions", specifically what does your WAA function 
> look like and what are you returning? Is it just a HTML formatted character 
> string? 

You could return almost anything, from pre-build HTML, JSON or XML content
up to plain text...this only depends on how you are going to use the return
value in the client side java script code.

I'm using Yahoos YUI-Toolkit for a few dynamic web forms that would
otherwise require arkward code constructions to work as they have to update
several drop-down fields with data from the web application depending on
other selections inside the page.

So instead of sending the whole page and generating a complete new one, I
only send the users selection to WAA and re-populate the other dropwowns
with the returned information, which in my case is a XML string.

Basically the WAA form function looks like this, the important part is to
use resetCache() and set the correct content type:

FUNCTION ReturnXMLData(oH)
LOCAL cHead := '<?xml version="1.0" encoding="ISO-8859-1"?><data>'
LOCAL cFoot := '</data>'
LOCAL cData

    here you do the processing and construct the XML output
   cData := "some XML string"  

   oH:ResetCache()
   oH:cContentType := "text/xml; charset=utf-8"
   oH:Put(cHead + cData + cFoot)

RETURN true

All the the other processing is done on the client-side via javascript.

> BTW, you might consider moving this to the WAA newsgroup.

x-post & Follow-up set.

regards
thomas