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

حقل للوقت فقط في APEX باستخدام Flatpickr

English version

Sometimes a form needs a clear time-only input. Flatpickr can provide that interaction in an APEX page when its behavior suits the application. Thanks to Ahmed Sherif, whose contribution I acknowledged in the original post.

Start with a text item named P10STARTTIME. Load the chosen Flatpickr CSS through the page's CSS File URLs and its JavaScript through JavaScript File URLs. Use the official installation guidance to obtain the assets, and keep a tested version pinned for repeatable deployment. Flatpickr: getting started.

After the library and item are available, initialize it in Execute when Page Loads:

flatpickr("#P10_START_TIME", {
  enableTime: true,
  noCalendar: true,
  dateFormat: "H:i",
  time_24hr: true
});

This enables time selection, hides the calendar, and formats the value as hours and minutes using a 24-hour clock. The official examples include this time-only configuration. Flatpickr: examples.

Test keyboard use, mobile behavior, and the dialog layout in the actual page. A widget that looks good in a demo still needs to fit the application's users. Avoid attaching a second date/time widget to an item that already manages its own picker.

The selected string also needs server-side validation and a clear storage rule. Decide whether the business value is a local time of day or part of a dated event; the picker alone does not define that meaning.

Editorial correction: LinkedIn's extracted hashtag formatting broke the original selector. The valid selector is exactly #P10_START_TIME, without a newline or “hashtag” text.

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

أحيانًا الفورم يحتاج إدخال وقت فقط بطريقة واضحة. Flatpickr تقدر توفر التفاعل ده داخل صفحة APEX لما سلوكها يناسب التطبيق. وكل الشكر للمهندس أحمد شريف — Ahmed Sherif، اللي ذكرت فضله في البوست الأصلي.

ابدأ بـText Item اسمه P10STARTTIME. حمّل CSS الخاص بالنسخة المختارة من Flatpickr في CSS File URLs للصفحة، وJavaScript في JavaScript File URLs. استخدم إرشادات التثبيت الرسمية للحصول على الملفات، وثبّت رقم نسخة اختبرتها علشان النشر يكون قابلًا للتكرار. دليل البداية.

بعد تحميل المكتبة وظهور العنصر، ضع التهيئة في Execute when Page Loads:

flatpickr("#P10_START_TIME", {
  enableTime: true,
  noCalendar: true,
  dateFormat: "H:i",
  time_24hr: true
});

الكود يفعّل اختيار الوقت، ويخفي التقويم، وينسق القيمة كساعات ودقائق بنظام 24 ساعة. الأمثلة الرسمية تتضمن إعداد الوقت فقط. أمثلة Flatpickr.

اختبر لوحة المفاتيح والموبايل وشكل الـDialog في الصفحة الحقيقية. شكل الأداة في الديمو لا يكفي للحكم على ملاءمتها للمستخدمين. وتجنب تركيب أداة ثانية على Item عنده Picker خاص به بالفعل.

القيمة النصية المختارة تحتاج أيضًا Validation على السيرفر وقاعدة واضحة للتخزين. حدد هل المقصود وقت محلي خلال اليوم، أم جزء من حدث له تاريخ؛ الأداة وحدها لا تحدد المعنى ده.

تصحيح تحريري: تنسيق الهاشتاج في النص المستخرج من LinkedIn كسر الـSelector الأصلي. الصيغة الصحيحة هي #P10_START_TIME بالضبط، من غير سطر جديد أو كلمة “hashtag”.