Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
<%@ page import="java.util.*,com.frevvo.forms.client.*,com.frevvo.forms.client.util.*" %>
FormsService service = (FormsService) session.getAttribute ( "frevvo.forms.service" );
if (service == null) {
    service = new FormsService("http", "localhost", 8082, null);
    service.loginAs (request.getParameter( "username" ),
        tenantAdminUserId, tenantAdminPassword, true, null,
        request.getParameter( "firstname" ),
        request.getParameter( "lastname" ),
        request.getParameter( "email" ), null);
    }
session.setAttribute ("frevvo.forms.service", service);

...

Embed a form or workflow with authentication

...

 

Info

 Make sure you have read and understood the documentation on

...

making forms and flows public

...

.

...

Now that you have logged in, you must use the FormsService created above to get an embed URL for the form/flow that you want to embed.<pre>

Code Block
FormTypeEntry ftEntry = (FormTypeEntry) service.getEntry(

...


        service.getEntryURL(FormTypeEntry.class, "_iAMawOa4Ed-TkpzYF5hpcQ!_MOrvYeV9Ed-6Ft_YAwCXMQ!designer"),

...


        FormTypeEntry.class);

...


String formUrl = ftEntry.getFormTypeEmbedLink(null).getHref();

...

The ID is constructed using the syntax: formTypeId!applicationId!ownerId where:*

  • formTypeId is the ID of the form/flow.

...

  • applicatioinId is the ID of the frevvo application containing the form/flow.

...

  • ownerId is the ID of the designer user who owns the form/flow.

You can find the IDs using the Share dialog for the form or flow in question. In the Figure below, the Share URL contains:<pre>

Code Block
http://localhost:8080/frevvo/web/tn/myt.com/user/designer/app/_Eo5BUQndEeCBmoiAt_ZHPg/flowtype/_BgfQgAneEeCBmoiAt_ZHPg/

...

popupfor

</pre> *

  • The formTypeId (in this case it is actually a flowTypeId) is _BgfQgAneEeCBmoiAt_ZHPg

...

  • The application Id is _Eo5BUQndEeCBmoiAt_ZHPg

...

  • The ownerId is designer

...

[[Image:Flow_Share_Dialog.png|frame|left|Share Flow Wizard]]

...

Panel

Image Added

Share Flow Wizard

Once you have the embed URL, embed it in your JSP as:<pre>

Code Block
<script src="<%= formUrl %>" type="text/javascript" language="Javascript"></script>

...

...

Finding an existing saved form/flow

...

 

Info

Make sure you have read and understood the documentation on

...

saving partially completed forms or flows

...

.

...


...

Make sure you have read and understood the documentation on

...

using the Task List

...

.

...

If your user has a saved form/flow, you can find it and render the saved form/flow instead of creating a new one as described above.<pre>

Code Block
Map<String, Object> params = new HashMap<String, Object>();

...


params.put("container", true); // Creates a container (HTML table or div) around the form.

...


params.put("center", false); // Center the container on the page if desired.

...


params.put("resize", true); // Automatically resize the container as the form's height changes.

...


// First, check if there is a SAVED task for the formTypeId in question.

...


String formUrl = null;

...


TaskFeed sFeed = service.getFeed(service.getFeedURL(TaskFeed.class), TaskFeed.class);

...


for (TaskEntry sEntry : sFeed.getEntries()) {

...


if (!("SAVED".equals(sEntry.getState())))

...


continue;

...


if (!sEntry.getFormTypeEmbedLink(null).getHref().contains("_iAMawOa4Ed-TkpzYF5hpcQ"))

...


continue;

...


formUrl = sEntry.getFormTypeEmbedLink(params).getHref();

...


break;

...


}

...


if (formUrl == null) {

...


// No saved task found. Create a new form instance.

...


FormTypeEntry ftEntry = (FormTypeEntry) service.getEntry(

...


service.getEntryURL(FormTypeEntry.class, "_iAMawOa4Ed-TkpzYF5hpcQ!_MOrvYeV9Ed-6Ft_YAwCXMQ!designer"),

...


FormTypeEntry.class);

...


formUrl = ftEntry.getFormTypeEmbedLink(params).getHref();

...


}

...


<script src="<%= formUrl %>" type="text/javascript" language="Javascript"></script>

...