Code Block Response

Top  Previous  Next

Once one of the button-stype webitem buttons is pressed, the equivalent of a web form is submitted to the UnForm server, to run the same rule set that contains the detect and button commands (-f and –r are used, along with any args options and a hard-coded "-p pdf").  The following values are available in the cgi$ template:

 

cgi.action$

The name of the webaction button that was pressed to load or autorun the web form.

cgi.button$

The name of the button webitem that was pressed.

cgi.panel$

Returns the name of the active panel when the button was pressed, or "*" if no panels are defined.

cgi.field_name$

One field for each webfield and webitem in the form.  Checkboxes can have multiple items in the value, each separated by chr(1) ($01$).  Any spaces in the name of the associated webfield or webitem is replaces with underscores (a web field named "Doc ID" becomes cgi.field_doc_id$).

cgi.dataurl_name$

For file-type webitems, the file content is provided as a data url value, which can be decoded with the dataurldecode() function.  Other dataurl* functions are also provided, documented in the internal functions table.

 

 

Use the prejob code block to interpret these items, and generate a cgiresponse$ string value.  This value is returned to the web extension for processing, based on the content:

 

http: or https: prefix displays a URL in a new window, generally used to open a document or indexed view page
error: message text (use \n or <br> for line breaks) displays a message box titled "error"
message: message text displays a message box titled "message"
thumbnails + documents - a multi-line response (use $0a$ or chr(10) between lines) beginning with "thumbnails" presents clickable thumbnails of UnForm images, specified as additional lines with pipe-delimited syntax library|doctype|docid|subid
multiview + documents - a multi-line response beginning with "multiview" presents a multiview frame with UnForm document or other pages, with UnForm documents identifed with pipe-delimited syntax library|doctype|docid|subid (subid element optional), or as http/https url values
other text renders in local browser window, and assumes HTML content

 

The webapi object can be used to generate http URL responses.  Note these URL values can also be used in <a href="URL"> tags in a pure html response.

 

If no cgireponse$ is available, the print job result is returned instead, allowing artificial print jobs to execute (by generating text pages in a prejob code block, and allowing normal rule set processing to handle the job).  The print job will be in PDF format.