Document viewer Field Help

How can we add something like an "Upload" or "Preview Document" button on the form that submits (typically without validation), and simply chains back to itself - this will give the user the impression they have not left the form, but turns the document into an official object that can then be previewed.

  Discussion posts and replies are publicly visible

Parents
  • This is pretty much as straightforward as adding a!buttonArrayLayout() on the interface that submits the form, then the form will chain back to itself - typically with a decision node to determine if they are asking for a preview, or submitting/canceling the form to move the process:

    A quick and dirty sample interface would be something like below with 2 inputs for document (document), and navigation (text):

    a!localVariables(
      local!document,
      /* there are more graceful ways to check for doc existance */
      local!documentExists: not(tostring(ri!document)="[Document:]"),
      a!formLayout(
        label: "Document Upload / Preview",
        contents: {
          a!columnsLayout(
            columns: {
              a!columnLayout(
                contents: {
                  a!boxLayout(
                    label: "Select Document",
                    style: "ACCENT",
                    contents: {
                      a!sideBySideLayout(
                        items: {
                          a!sideBySideItem(
                            item: a!fileUploadField(
                              value: local!document,
                              saveInto: local!document,
                              maxSelections: 1
                            )
                          ),
                          a!sideBySideItem(
                            item: a!buttonArrayLayout(
                              buttons: {
                                a!buttonWidget(
                                  label: "Preview Document",
                                  value: "PREVIEW",
                                  saveInto: {
                                    ri!navigation,
                                    a!save(ri!document,local!document)
                                  }
                                )
                              }
                            )
                          )
                        }
                      )
                    }
                  )
                }
              ),
              a!columnLayout(
                contents: {
                  a!boxLayout(
                    label: "Select Document",
                    style: "ACCENT",
                    contents: {
                      a!documentViewerField(
                        showWhen: local!documentExists,
                        document: ri!document
                      ),
                      a!richTextDisplayField(
                        showWhen: not(local!documentExists),
                        value: {
                          a!richTextItem(
                            text: "You must click Preview on the left for the document to be viewed",
                            style: "EMPHASIS"
                          )
                        }
                      )
                    }
                  )
                }
              )
            }
          )
        },
        buttons: a!buttonLayout(
          primaryButtons: {
            a!buttonWidget(
              label: "Submit",
              validate: true,
              submit: true,
              value: "SUBMIT",
              saveInto: {
                ri!navigation,
                a!save(ri!document,local!document)
              }
            )
          },
          secondaryButtons:  {
            a!buttonWidget(
              label: "Cancel",
              validate: false,
              submit: true,
              value: "CANCEL",
              saveInto: ri!navigation
            )
          }
        )
      )
    )

    Just to note, this is a continuation of the other thread on the topic.

  • 0
    Certified Lead Developer
    in reply to Chris
    this is a continuation of the other thread on the topic

    and... copied nearly word-for-word from your comment -- and... posted by 2 separate accounts ... *scratches head*  Confused

Reply Children