Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8496765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:56:34+00:00 2026-06-10T23:56:34+00:00

I want to make a calendar where you can select the date, and automatically

  • 0

I want to make a calendar where you can select the date, and automatically you can select the time. I shouldn’t use butons to change the time 🙁

So I have the next:

<rich:calendar id="currentDate" popup="true"
    datePattern="dd/MM/yyyy - HH:mm" enableManualInput="false"
    showFooter="false" required="true" resetTimeOnDateSelect="true"
    oncollapse="return timeSelected;"
    showWeeksBar="false" showWeekDaysBar="true"
    value="#{bean.currentDate}"
    ondateselected="timeSelected=false; Richfaces.getComponent('calendar',this).showTimeEditor(); return true;"
    ontimeselected="timeSelected=true; return true;"
    ontimeselect="timeSelected=true; return true;"
>
    <a4j:support event="onchange" ajaxSingle="true" />
</rich:calendar>

But it doesn’t work at all.
There are two problems.

1 – When you choose a day, the popup appears. But if you press ‘Accept’ withouth changing the time, you can’t close the calendar 🙁

2 – Once you have selected the date/time, but you want to change only the time, you can’t do it because you can’t select the current day, so you can’t see the time editor.

I’m using rich faces 3.3.3

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T23:56:35+00:00Added an answer on June 10, 2026 at 11:56 pm

    The ondateselected and ontimeselected attributes are only invoked when the date or time is actually changed, not when you just click on the date or closes the time editor. There are no standard <rich:calendar> attributes which capture that. You need to override the standard calendar.js functions eventCellOnclick() (which is invoked when a date is clicked) and hideTimeEditor() (which is invoked when time editor is closed).

    The following works for me with RichFaces 3.3.3 (and Mojarra 1.2_15 and Tomcat 7.0.29).

    <h:form id="form">
        <rich:calendar id="currentDate" popup="true"
            datePattern="dd/MM/yyyy - HH:mm" enableManualInput="false"
            showFooter="false" required="true" resetTimeOnDateSelect="true"
            showWeeksBar="false" showWeekDaysBar="true"
            value="#{bean.currentDate}"
            oncollapse="return this.component.timeSelected;"
        >
            <a4j:support event="onchange" ajaxSingle="true" />
        </rich:calendar>
    </h:form>
    
    <script>
        var currentDateComponent = $('form:currentDate').component;
    
        var originalCellOnClickFunction = currentDateComponent.eventCellOnClick;
        currentDateComponent.eventCellOnClick = function() {
            this.timeSelected = false;
            originalCellOnClickFunction.apply(this, arguments);
            currentDateComponent.showTimeEditor();
        };
    
        var originalHideTimeEditorFunction = currentDateComponent.hideTimeEditor;
        currentDateComponent.hideTimeEditor = function() {
            this.timeSelected = true;
            originalHideTimeEditorFunction.apply(this, arguments);
        };
    </script>
    

    Note that ondateselected, ontimeselect and ontimeselected attributes are removed and that oncollapse attribute has been changed. Also note that the script must be executed after the calendar is been populated in the DOM. So the above works as-is. If you want to move the script into its own JS file (which is a good thing), make sure that it’s executed on DOM ready only (i.e. put script in end of <body>, or execute it by window.onload() or jQuery.ready()).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When you use Google Calendar and want to make a new event, you can
I have style sheet with a class name changebackgroundcolor i want make change in
I want to get the date from a rich:calendar component in javascript in order
I want to make custom calendar view in iOS.I can swipe the calendar monthly
I have a Grails application I created a Gregorian Calendar GMT date. The time
I want to make an app...that can sync my iphone calender with google calendar..i
I want to make Task in Google Calendar using Google Calendar API : c#.
I want to make a custom ASP.NET control that is a subclasse of System.Web.UI.WebControls.Calendar
I want make interactive application where user launches it and can do various task
I want to make a a month view Calendar for iPad like the one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.