Popup Calendar Picker

The classic form helper. This script opens a dedicated calendar window, allowing users to click a date and have it automatically populate a text field on your main form.

Note: This simulates the parent-child window interaction.

Copy the Script

<script>
function pickDate(fieldId) {
    // Open the calendar window (You need a separate calendar.html file)
    window.open("calendar.html?field=" + fieldId, "calendar", "width=300,height=300");
}
</script>

<input type="text" id="myDate">
<button onclick="pickDate('myDate')">Select</button>

Frequently Asked Questions

Modern browsers support `<input type='date'>` natively, which is mobile-friendly and generally better. This script is useful for legacy systems or if you need a specific custom calendar layout that the native picker doesn't support.

The popup window uses `window.opener.document.forms...` to pass the selected value back to the input field on the parent page.

It might be blocked if not triggered by a direct user click. Since it opens a real new window (`window.open`), aggressive blockers might flag it.