Simulating Remote Procedure Calls

JavaScript provides no direct way to connect to a database. Usually, whenever the user has to choose among a set of elements the entire set is packed in a suitable HTML input element (e.g., SELECT) and sent to the browser.

This approach, however, makes it impossible to edit large databases. ERW aims at the greatest generality, and thus implements on top of HTTP a simulated remote procedure call (RPC) mechanism using a hidden frame (this technique is often called remote scripting).

Every form contains an invisible IFRAME element that is used to interact with the server. Whenever the user interface code needs some data from the database (for instance, because the user is browsing a set of entities) the location of the IFRAME element is set to a particular URL that will load into the IFRAME element some JavaScript code; in turn, this code manipulates via the DOM the user interface, shows these data to the user, and updates the JavaScript state. The effect is much like an RPC.