Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Form

  1. English
    Add a Hidden Field to the first form, set the ID to "id" and add in the following value into Default Value. The first form meant here is the one that it mapped to the Run Process entity in the process activity mapping.
    Thai

    เพิ่มเขตข้อมูลที่ซ่อนอยู่ในแบบฟอร์มแรกตั้งค่า ID เป็น "id" และเพิ่มค่าต่อไปนี้เป็นค่าเริ่มต้น รูปแบบแรกหมายถึงที่นี่เป็นรูปแบบที่แมปกับเอนทิตี Run Process ในการแมปกิจกรรมกระบวนการ

    Code Block
    #requestParam.recordId#

    This is so that, if there's existing record being loaded, when the new process instance is created, the process instance will refer to this very record subsequently.

    Thai

    นี่คือเพื่อที่ว่าถ้ามีการโหลดเร็กคอร์ดที่มีอยู่เมื่ออินสแตนซ์กระบวนการใหม่ถูกสร้างขึ้นอินสแตนซ์กระบวนการจะอ้างถึงเรกคอร์ดที่มากนี้ในภายหลัง

  2. In the same form, create a new section, leave it empty. Edit the section, set the Load Binder to Bean Shell Form Binder. Insert the following code into it.

    Thai

    ในฟอร์มเดียวกันให้สร้างหัวข้อใหม่เว้นว่างไว้ แก้ไขส่วนตั้งค่าเครื่องผูกการโหลดเป็น Bean Shell Form Binder ใส่รหัสต่อไปนี้ลงไป

    Code Block
    languagejava
    linenumberstrue
    import org.joget.apps.form.lib.SaveAsDraftButton;
    import org.joget.apps.form.lib.CustomHTML;
    import org.joget.apps.form.model.Column;
    import org.joget.apps.form.model.Element;
    import org.joget.apps.form.model.FormAction;
    import org.joget.apps.form.model.FormData;
    import org.joget.apps.form.model.Section;
    import org.joget.apps.form.service.FormUtil;
    import java.util.ArrayList;
    import java.util.Collection;
    
    Collection formActions = new ArrayList();
    
    String saveButtonLabel = "Save As Draft";
    Element saveButton = new SaveAsDraftButton();
    saveButton.setProperty(FormUtil.PROPERTY_ID, "saveAsDraft");
    saveButton.setProperty("label", saveButtonLabel);
    
    formActions.add(saveButton);
    Section section = element;
    ArrayList columns = (ArrayList) section.getChildren();
    Column column = columns.get(0);
    column.setProperty("horizontal", "true");
    column.setChildren(formActions);
    
    //add a custom html to fix the layout issue
    Element html = new CustomHTML();
    String script = "<script>$(document).ready(function(){";
    script += "$(\"#"+section.getPropertyString("id")+"\").find(\".form-cell\").prependTo(\"#section-actions .form-column\");";
    script += "$(\"#"+section.getPropertyString("id")+"\").remove();";
    script += "});</script>";
    
    html.setProperty("id", "button_layout_fixes");
    html.setProperty("label", "");
    html.setProperty("value", script);
    
    formActions.add(html);
    
    return null;

...