Oracle APEX 19.2日历创建链接:将选中日期传递至目标页面
Hey Adam, this is totally doable—you just need to pass the selected date as part of your jump link, since many out-of-the-box calendar widgets don’t expose this option directly in their basic UI settings. Here’s how to pull it off depending on your setup:
1. Use URL Query Parameters (Most Universal Method)
This is the simplest and most widely compatible approach. You’ll dynamically append the selected date to your target page’s URL as a query parameter:
- If you’re using a low-code/no-code platform: Look for "dynamic parameters" or "bind component values" in your link settings. Most tools let you map the calendar’s selected date value to a query parameter (e.g.,
?selectedDate=[Calendar.SelectedDate]). This might be hidden in an "advanced" tab of the link configuration. - If you’re working with custom code: Listen for the calendar’s date selection event, format the date, and build a URL with the parameter. Here’s a quick JavaScript example:
// Assume your calendar has a date selection callback yourCalendarInstance.on('dateSelected', (selectedDate) => { // Format date to a standard string (e.g., YYYY-MM-DD) const formattedDate = selectedDate.toISOString().split('T')[0]; // Build target URL with encoded date parameter const targetUrl = `your-target-page.html?selectedDate=${encodeURIComponent(formattedDate)}`; // Trigger the jump window.location.href = targetUrl; });
2. Retrieve the Date on the Target Page
Once the date is in the URL, your target page needs to read it and assign it to the desired item. Here’s how to do that with vanilla JavaScript:
// Get the query parameter from the URL const urlParams = new URLSearchParams(window.location.search); const selectedDate = urlParams.get('selectedDate'); // Assign the date to your page element (e.g., a text box or display area) if (selectedDate) { document.getElementById('target-date-element').textContent = selectedDate; // Or set a form input value: // document.getElementById('date-input').value = selectedDate; }
3. Alternative: Use Browser Storage (For Same-Domain Setups)
If you don’t want the date visible in the URL, you can temporarily store it in localStorage or sessionStorage:
- On the calendar page (when date is selected):
const formattedDate = selectedDate.toISOString().split('T')[0]; localStorage.setItem('selectedCalendarDate', formattedDate); window.location.href = 'your-target-page.html'; - On the target page:
const selectedDate = localStorage.getItem('selectedCalendarDate'); if (selectedDate) { // Assign to your element document.getElementById('target-date-element').textContent = selectedDate; // Clean up storage to avoid leftover values localStorage.removeItem('selectedCalendarDate'); }
If you’re using a specific platform or calendar plugin, check its documentation for built-in dynamic linking features—many tools have this functionality tucked away in advanced settings, so you might not need to write code at all.
内容的提问来源于stack exchange,提问作者Adam Williamson

