This example shows how to create a form that lets you change the owner for a task. The example begins with the creation of the form and the Assign Task button that, when clicked, assigns a task to a user. Since this form handler works for process and project tasks, the code determines which is being used and passes the appropriate ID to the form handler. The task ID is also passed to the form handler. If the current task is complete, the task owner displays. For all other circumstances, the form contains a drop-down list with one option for each user eligible to own the task.

<dspel:importbean bean="/atg/epub/servlet/TaskActionFormHandler"/>

<dspel:form formid="assignForm" name="assignForm" method="post"
 action="${actionURL}">
   <dspel:input type="submit" bean="TaskActionFormHandler.assignTask"
    value="Assign Task"/>
   <c:choose>
      <c:when test="${taskInfo.taskDescriptor.assignable eq false}"/>
      <c:otherwise>
         <dspel:input type="hidden" bean="TaskActionFormHandler.processId"
          value="${projectContext.process.id}"/>
         <c:if test="${isProjectView eq true}">
            <dspel:input type="hidden" bean="TaskActionFormHandler.projectId"
             value="${projectContext.project.id}"/>
         </c:if>

         <dspel:input type="hidden" bean="TaskActionFormHandler.taskElementId"
          value="${taskInfo.taskDescriptor.taskElementId}"/>

         <pws:getAssignableUsers var="assignUsers"
          taskDescriptor="${taskInfo.taskDescriptor}"/>

         <c:set var="unowned" value="${taskInfo.owner eq null}"/>
         <c:choose>
            <c:when test="${taskStatus.completed}">
               <c:out value="${taskInfo.owner.firstName}
                ${taskInfo.owner.lastName}"/>
            </c:when>
            <c:otherwise>
               <dspel:select bean="TaskActionFormHandler.assignee">

                  <c:forEach var="user" items="${assignUsers}">
                     <c:if test="${currentUserId ne user.primaryKey}">
                         <dspel:option value="${user.primaryKey}
                          :${user.userDirectory.userDirectoryName}"
                          selected="${user.primaryKey eq
                          taskInfo.owner.primaryKey}"><c:out
                          value="${user.firstName}
                          ${user.lastName}"/></dspel:option>
                     </c:if>
                  </c:forEach>

               </dspel:select>
            </c:otherwise>
         </c:choose>
      </c:otherwise>
   </c:choose>
</dspel:form>