Code Block Response For Buttons

Top  Previous  Next

Once one of the 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.button$

Returns button title, indicating which button was pressed.

cgi.selected$

Returns text of a text field associated with the button.

cgi.panel$

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

cgi.data$

Returns all the panels and text fields in an INI file format.  Panel titles are used as section headers, and text and clipboard field text boxes are returned in name=value format.  If no panels are provided, a single section header [*] is supplied.

 

This format allows multiple fields of data to be submitted and interpreted by the rule set,  by using the getinival() function, passing cgi.data$ as the first argument.  For example, name$=getinival(cgi.data$, "CustPanel", "Name") would set name$ to the value of the Name field in the CustPanel panel.

cgi.parsevalue$

Returns the value of the clipboard or window title in cases where the parsevalue option is specified.  Note that if this value is present, DTC is submitting a request for reformatting of this data.  It is not a result of the user pressing a DTC submit button.  No cgi.selected$ or cgi.data$ is sent.

 

 

Use the prejob code block to interpret these items, and generate a cgiresponse$ string value.  This value is returned to DTC for processing.  DTC interprets the response in these ways:

 

http: or https: prefix performs shell launch to display URL in the default browser
error: message text (use \n for CRLF) displays an error style message box
message: message text (use \n for CRLF) displays an information style message box
other text renders in local browser control, and assumes HTML content

 

The webapi object can be used to generate http responses.  Note these http values can also be used in <a href=> 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.