Workflow and forms in Wave

I have created an application to simulate how it is possible to make workflow applications in Google Wave. A description and reason why workflows are interesting can be found on this page. Also look at the robot wave samples to test out the solution. In this blog I’ll describe how workflows and forms can be created inside waves. The code can be found at hire.


Forms are a quite basic part of all types of application, where the application requires some structured data to handle its processing. This could be Google search page with text field to enter the query and a submit button. It is also possible to create forms in Wave applications. A form in a wave can be created with the following commands.

Blip blip = wavelet.appendBlip();
TextView textView = blip.getDocument();
textView.appendMarkup("<p><b>Welcome to the First Wave Bank</b></p>");
FormView form = textView.getFormView();
form.append(new FormElement(ElementType.LABEL, "labelname","Your name"));
form.append(new FormElement(ElementType.INPUT, NAME_FIELD));

form.append(new FormElement(ElementType.LABEL, "labelamount",
        "Borrow amount in $"));
form.append(new FormElement(ElementType.INPUT, AMOUNT_FIELD));
form.append(new FormElement(ElementType.BUTTON, "submit", "Apply"));

First the blip we want on insert the form in is created. On the blip is it then possible to append XHTML styled text like showed.

The FormView element is created from the TextView. It is possible to add form elements to the FormView. Elements is added to the form with new FormElement(ElementType.INPUT, NAME_FIELD). The ElementType covers the different values which can be used. Second parameter is the name of the field. After that the value which could be showed is placed. This could be the text on the submit button or the text of a label.

When the user has completed the form he presses the submit button. It is then possible to validate and use the content from the forms.

FormElement name = form.getFormElement(NAME_FIELD);
FormElement amount = form.getFormElement(AMOUNT_FIELD);
FormElement reject = form.getFormElement(REJECT_BUTTON);
String errorMessage = "";
// check the content of a text field
if (name.getValue() == null
    || name.getValue().trim().length() == 0) {
         errorMessage += "Please enter name:\n";
// check if the approve button is pressed

First the FormElement is retrieved using getFormElement with the field name. It will be a good idea of to use the constants variables, to make sure you time the name of the field correct.

The value of a text element can be found by using the getValue(). For buttons you can find the button by find the button with the value “clicked”.

The current limitation with forms is that you cannot create dropdown lists. An alternative could be to use Radio buttons.

For this application the robots sends responds as plain text commands back to the user. I don’t know if some other way for communication should be created. The response could be made in a blip and then this communication blip is overwritten every time the user interacts with the robot. I don’t like the usability aspect of any of the two solutions, because it is not clear to the user what have changed.


TheWaveBank robot guides the participant’s trough a process of completing the loan application. First when the robot is added it inserts a form using the commands showed in the first java code example.

To get the response, when the users press a button, the robot needs to subscribe to FORM_BUTTON_CLICKED.

If there is multiply forms in a wave it can be difficult to find the correct for to do the processing for. The best way would be to store information about which forms where placed which blips. Alternative is to use the approach used hire, where I check for a given form element to see which form I’m processing.

It is possible to see the user how has submitted a form with the getModifiedBy() on the blip. This can be compared to how are allowed to change the form. The elements of the forms then have to be set back to the original values. It would be better if it was possible to block access to blips for certain users.


Bookmark and Share

Published by


Daniel Graversen

Founder of and SAP Integration consultant at

One thought on “Workflow and forms in Wave”

Leave a Reply

Your email address will not be published. Required fields are marked *