You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Oracle APEX 19.2日历创建链接:将选中日期传递至目标页面

Is Passing Selected Calendar Date to Target Page Feasible?

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.09 00:47:41