Forms - for Workflow

Top  Previous  Next

 

New in version 8.0

 

 

Choosing 'Forms' from the document information page displays any defined and configured web forms associated with this library, document type, and user profile.

 

 

clip0058

 

 

In this simple example available in the demo_sales library and using the Invoice document type, choice of the 'Sample Approval Form' link displays a simple custom form for adding an 'Approved' or 'Denied' category to this document:

 

 

clip0057

 

 

Pressing the 'Submit' button processes an associated UnForm "rule-set defined task" that adds or changes the category on this document.

 

A browse category drill-down for the demo_sales library could then show documents according to their approval status.

 

 

clip0060

 

 

And in a re-display of the same form the new category is at the bottom of the list of categories displayed for the document.

 

 

clip0072

 

 

Any process that can be scripted in an UnForm rule-set can be performed when launched by a browser form.

 

The designer/integrator has access to powerful library 'objects' which simplify the process of coding even complex document processes.

 

 

 

 


 

* Admin Help

 

For further information see Browser Forms and Workflow

 


 

form_sample.html java script:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head>

   <link rel="stylesheet" type="text/css" href="[SCRIPT_NAME]?fl=default.css" />

   <link rel="stylesheet" type="text/css" href="[SCRIPT_NAME]?fl=custom.css" />

   <script language="JavaScript" src="[SCRIPT_NAME]?fl=common.js"></script>

   <title>

         Document Approval

   </title>

</head>

<body onunload="saveWindowInfo()">

 

<h2>Approve or Deny Action on this document</h2>

 

<form name="approval" action="[SCRIPT_NAME]" method="post">

<input type="hidden" name="a" value="uf">

<input type="hidden" name="args" value="-f cgiforms.rul -r approval -p pdf">

<input type="hidden" name="run" value="">

<input type="hidden" name="async" value="0">

<input type="hidden" name="lb" value="[lb]">

<input type="hidden" name="doctype" value="[doctype]">

<input type="hidden" name="docid" value="[docid]">

 

<table class="form">

       <tr>

               <th>Library</th>

               <td>[lb]</td>

       </tr>

       <tr>

               <th>Doc Type</th>

               <td>[doctype]</td>

       </tr>

       <tr>

               <th>Doc ID</th>

               <td>[docid]</td>

       </tr>

       <tr>

               <th>Categories</th>

               <td>

                       <script>

                               // present categories in lines

                               var cat='[categories]';

                               cat=cat.replace(/;/g,"<br>");

                               cat=cat.replace(/\|/g," &gt; ");

                               document.write(cat);

                       

                       </script>

               </td>

       </tr>

       <tr>

               <th>Approval</th>

               <td>

                       <input type="radio" name="approval" value="0" checked>Denied<br>

                       <input type="radio" name="approval" value="1">Approved<br>

               </td>

       </tr>

       <tr>

               <td colspan="2" style="text-align:center;">

                       <input type="button" value="Submit" onclick="submitForm()">

                       &nbsp;&nbsp;&nbsp;

                       <input type="button" value="Cancel" onclick="window.close();">

               </td>

       </tr>

</table>

</form>

 

</body>

</html>

<script>

       function submitForm() {

               document.approval.run.value="y";

               document.approval.submit();

       }

</script>

 


 

Approval rule-set in samples/cgi-forms.rul:

 

[approval]

 

prejob{

       approved=num(cgi.approval$)

       cgiresponse$="Approved"

       if not(approved) then cgiresponse$="Not approved"

       # set problem message for unsuccesful update

       msg$="Problem encountered. Categories not updated."

       setlogin("admin","admin")

       o=new("library",cgi.lb$)

       doctype$=cgi.doctype$

       docid$=cgi.docid$

       x1=o'getdoc(doctype$,docid$,prop$)

       if x1:

               cat$=prop.categories$+";"

               x$="seed"

               while x$<>""

                       x$=getpatternvalue("status|",";",cat$,1,1)

               wend

               cat$+=";"+"status|"+cgiresponse$

               while pos(";;"=cat$)

                       cat$=sub(cat$,";;",";")

               wend

               prop.categories$=cat$

               x2=o'putdoc(doctype$,docid$,prop$)

               if x2:

                       msg$="Document categories updated."

               endif

       endif

       cgiresponse$+="<br><br>"+msg$

       }