المكتبة التقنية ←

Ajax أم Page Submit؟ اختار دورة المعالجة

English version

The useful question is not simply which request looks faster. It is which processing contract the user action needs.

Use submit for the page's processing flow

A page submit enters APEX page processing: submitted state, applicable computations, validations, processes, and branches. Conditions and button settings determine what actually runs. Submit is a natural fit for a form that already has declarative validation and save processing.

Use Ajax for a targeted interaction

A dashboard filter usually needs fresh data in selected regions. Submit the relevant filter items and refresh those regions. A custom apex.server.process call invokes a named callback; it does not automatically execute the page's full submit-validation lifecycle. Oracle's Ajax API.

Consequently, the callback must enforce its own input rules, authorization, and business invariants, preferably through shared server-side operations. Define what success means and how the interface responds to failure or duplicate clicks.

Both approaches can modify data and participate in database transactions. Ajax can have side effects, including committed changes. Transport choice does not determine business atomicity.

Editorial correction: the original post described Ajax as having no side effects, reserved transactions for submit, and claimed large systems use events instead of state machines. Those claims were too broad.

Measure request count, SQL time, payload size, and user effort. Choose the smallest interaction that still preserves the required processing and security guarantees; event handling and explicit business states can work together.

Reference: APEX page processing.

النسخة العربية

السؤال المفيد مش مجرد: أي طلب شكله أسرع؟ السؤال هو: تصرف المستخدم محتاج دورة معالجة إيه؟

استخدم Submit لدورة معالجة الصفحة

Page Submit تدخل في معالجة APEX: القيم المرسلة، والـComputations والـValidations والـProcesses والـBranches المنطبقة. الشروط وإعدادات الزر تحدد إيه اللي هيتنفذ فعلًا. Submit مناسبة لفورم عندها بالفعل تحقق وحفظ تصريحي.

استخدم Ajax لتفاعل محدد

فلتر Dashboard غالبًا يحتاج تحديث بيانات Regions معينة. ابعت عناصر الفلتر المطلوبة وحدّث المناطق دي. استدعاء apex.server.process المخصص ينفذ Callback باسم محدد، ولا يشغّل تلقائيًا دورة Validations الكاملة الخاصة بـSubmit الصفحة. واجهة Ajax من Oracle.

بالتالي، الـCallback لازم تتحقق بنفسها من المدخلات والصلاحيات وقواعد العمل، ويفضل عن طريق عمليات مشتركة على السيرفر. حدد معنى نجاح العملية، وتصرف الواجهة عند الفشل أو الضغط المتكرر.

الطريقتان تقدر تعدل بيانات وتشارك في Transactions. Ajax ممكن يكون لها آثار جانبية، منها تغييرات محفوظة بـCommit. طريقة إرسال الطلب لا تحدد وحدها إن العملية التجارية تتم كلها أو لا تتم.

تصحيح تحريري: البوست الأصلي وصف Ajax بأنها بلا آثار جانبية، وخصص Transactions لـSubmit، وادّعى إن الأنظمة الكبيرة تستخدم Events بدل State Machines. دي تعميمات غير دقيقة.

قِس عدد الطلبات، ووقت SQL، وحجم البيانات، ومجهود المستخدم. اختار أصغر تفاعل يحافظ على المعالجة والأمان المطلوبين؛ التعامل مع الأحداث وتحديد حالات العمل يقدروا يشتغلوا مع بعض.

المرجع: معالجة صفحات APEX.