Table of Contents

Search

  1. Preface
  2. Overview, Downloading, and Installing
  3. Administration API
  4. Identity Service API
  5. Screenflow Programming and SDK
  6. ActiveVOS WSHT API
  7. Embedding Request Forms in Standalone Web Pages
  8. XML-JSON for Process Central

APIs, SDKs, and Services

APIs, SDKs, and Services

Request Form Attachments

Request Form Attachments

In order to support attachments in process request forms, the following changes must be made to the form.
  1. Find the input
    <form>
    tag and change it to specify
    POST
    as the method and
    multipart/form-data
    as the enctype.
    Change the following:
    <form id="DocumentInputForm$ID" name="DocumentInputForm$ID" action="">
    to use
    POST
    method and
    multipart/form-data
    enctype:
    <form id="DocumentInputForm$ID" name="DocumentInputForm$ID" action="" method="post" enctype="multipart/form-data">
    Note
    : This example shows form ID
    DocumentInputForm$ID
    . You should not change the form ID in your HTML file.
  2. On the next line directly below the updated
    <form>
    tag, add the following hidden input fields:
    <input type="hidden" name="_json" value="" class="_json$ID" /> <input type="hidden" name="responseContentType" value="text/html" /> <input type="hidden" name="responseWrap" value="textarea" />
  3. Add the HTML control for file upload within the HTML form. Here is an example:
    <input id="Document_attachment_1$ID" name="Document_attachment_1" value="" size="50" type="file" />
  4. Move the submit button which currently is located outside of the
    <form>
    tags into the form so that it is before
    </form>
    .
  5. Change the type of the submit button from
    type='button'
    to
    type='submit'
    .
    <input type="submit" id="sendRequest$ID" value="Send Request" class="avc_form_instance_save" />
  6. Delete the following two lines of JavaScript from the
    documentReady
    function:
    // Assign handler for saving form data entered by the user $("#sendRequest$ID").click(_submitRequest);
  7. Add the following JavaScript to the
    documentReady
    function:
    $('#DocumentInputForm$ID').submit(function() { _submitRequest(); // Important always return false to prevent standard browser submit // and page navigation return false; });
  8. Replace the following JavaScript in the
    _submitRequest()
    function:
    AE_AJAX_SERVICE_UTIL.postJSON(url, request, _showResponseCallback, _showFaultCallback, _communicationErrorCallback);
    with:
    var jsonString = JSON.stringify(request); $("._json$ID").val(jsonString); var options = { dataType : 'json', url: url, success: function(aJsonResponse) { alert("Success"); $("#sendRequest$ID").attr("disabled", false); }, error: function(aXMLHttpRequest, aTextStatus, aErrorThrown) { alert("ERROR"); $("#sendRequest$ID").attr("disabled", false); } }; $("#sayHelloInputPartInputForm$ID").ajaxSubmit(options);
    If you use this methodology (with the jQuery Forms plugin), the
    success
    callback function is used for success and for faults. Your code in the
    success
    callback function should examine the JSON result to determine if the response is a fault.

0 COMMENTS

We’d like to hear from you!