我有一個允許用戶匯入檔案 (BLOB)、評論和日期的表單。
我必須創建一個驗證函式,以檢查欄位是否為空,原因如下:
當檔案瀏覽器為空時,默認驗證回傳“未定義”,并且當它是日期選擇器時不會翻譯驗證文本,即使我在共享組件中翻譯了訊息:

- 因此,我決定使用 JavaScript 運算式創建一個動態操作來檢查欄位并顯示錯誤。
apex.message.clearErrors();
var chkErr = 0;
//declare fields
var arr = [
'P28_BLOB_DOCUMENT',
'P28_COMMENTAIRE_DOCUMENT',
'P28_DATE_DOCUMENT'
];
//declare Labels
var arrLabel = [
"Importer un document",
"Commentaire",
"Date d'exportation"
];
//Check NULL
for (var i in arr) {
if ($v(arr[i]).length == 0) {
apex.message.showErrors([
{
type: apex.message.TYPE.ERROR,
location: ["inline", "page"],
pageItem: arr[i],
message: arrLabel[i] " doit contenir une valeur",
unsafe: false
}
]);
chkErr = 1;
}
}
if ( chkErr == 0 ) {
/* Custom dynamic action call when no error occurred */
apex.message.confirm("Do you want to import this document ?", function(okPressed) {
if (okPressed) {
apex.submit({request:'insertDocumentProcess'});
//apex.submit('insertDocumentProcess');
}
});
}
一切正常,如果我將此 DA 添加到我的按鈕中,我將得到驗證:

Now here comes the real problem, if I use the Dynamic Action on the CREATE button, the auto process "Form - Automatic Row Processing (DML)", is not executing anymore. Even tough I tried to call it using the apex.submit('insertDocumentProcess'); or apex.submit({request:'insertDocumentProcess'});, the INSERT action is not executing on the database.
Here are all the details :
- The create button, with the code explained above

- The process that is generated automatically when creating the form, that I try to call

Did I miss something ? The INSERT was working fine when I'm not adding the validation function, so is the problem related to the way I'm calling the process ? Or is it because I'm trying to INSERT a BLOB FILE and I'm missing something ?
I tried different options, with another DA calling the process, but It wasn't successful.
最后我仍然收到來自流程的成功訊息,說“已創建行”,但它沒有出現在資料庫中。它仍然可以確認我正在成功呼叫該程序嗎?
提前致謝,
uj5u.com熱心網友回復:
Client-side Condition在您的動態操作中添加一個checkErrors。選擇JavaScript expression驗證文本欄位是否通過驗證
例子
(
apex.item('P28_BLOB_DOCUMENT').isEmpty() ||
apex.item('P28_COMMENTAIRE_DOCUMENT').isEmpty() ||
apex.item('P28_DATE_DOCUMENT').isEmpty()
)
True action 應該是驗證空欄位的 JavaScript 代碼(您在上面發布的代碼)。
apex.message.clearErrors();
var chkErr = 0;
//declare fields
var arr = [
'P28_BLOB_DOCUMENT',
'P28_COMMENTAIRE_DOCUMENT',
'P28_DATE_DOCUMENT'
]; //this is the code you pasted above
False action應該是一個 Action:Submit Page并填寫選項Request / Button Name:CREATE告訴 APEX 您想要Insert或SAVE如果您想要Update,這將重現正常提交的相同行為。

如果您有任何疑問,請告訴我。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/367873.html
標籤:javascript 甲骨文 过程 oracle-apex 数据表
