-
1. Re: How to update 2nd rich calendar when 1st rich calendar date changes
bleathem Aug 29, 2013 3:59 PM (in response to jlg29387)Post the facelet code of what you have tried so far, and we'll see if we can determine what's going wrong.
-
2. Re: How to update 2nd rich calendar when 1st rich calendar date changes
jlg29387 Aug 30, 2013 1:10 PM (in response to bleathem)This the code:
<h:outputText value="#{m.task_starDate}" /> <rich:calendar id="starDate" value="#{taskBean.newTask.starDate}" > <a4j:support event="onchange" action="#{taskBean.changeEndDate}" reRender="endDate"/> </rich:calendar> <h:outputText value="#{m.task_endDate}" /> <rich:calendar id="endDate" value="#{taskBean.newTask.endDate}"> </rich:calendar>
I've tried with OnChanged and onclick (Events) but can't get that when I select the start date, the end date calendar appear directly with the month and year of the start date selected.
I've Tried wit currentDate too, but en mode popup I read that doesn't work.
thanks.
-
3. Re: How to update 2nd rich calendar when 1st rich calendar date changes
jlg29387 Aug 30, 2013 1:12 PM (in response to jlg29387)This seems to work. The problem now is that I can't change the date manually so when I hit the button I get the start date which is what I wanted but I also want to change it if I wish. I want that the dates can be different too.
<h:outputText value="#{m.task_starDate}" /> <rich:calendar id="starDate" value="#{taskBean.newTask.starDate}" > </rich:calendar> <h:outputText value="#{m.task_endDate}" /> <rich:calendar id="endDate" value="#{taskBean.newTask.endDate}"> <a4j:support event="onclick" action="#{taskBean.changeEndDate}" reRender="endDate"/> </rich:calendar>
-
4. Re: How to update 2nd rich calendar when 1st rich calendar date changes
bleathem Aug 30, 2013 1:14 PM (in response to jlg29387)1 of 1 people found this helpfulThe first code snippet should be doing what you expected. Can you post the code of your bean method: #{taskBean.changeEndDate}
-
5. Re: How to update 2nd rich calendar when 1st rich calendar date changes
jlg29387 Sep 4, 2013 3:46 AM (in response to bleathem)This is the code
public void changeEndDate(){
newTask.setEndDate(newTask.getStartDay());
}
The problem I have is that it will not let me select another date on the calendar "end date", directly when I click on the calendar write start date, that is what I wanted but also I want that you can change it if you want.
-
6. Re: How to update 2nd rich calendar when 1st rich calendar date changes
bleathem Sep 4, 2013 3:23 PM (in response to jlg29387)Javier López wrote:
The problem I have is that it will not let me select another date on the calendar "end date", directly when I click on the calendar write start date, that is what I wanted but also I want that you can change it if you want.
What do you mean by "will not let me"? What happens? The data changes in the browser but not in the managed bean property?
-
7. Re: How to update 2nd rich calendar when 1st rich calendar date changes
jlg29387 Sep 5, 2013 3:25 AM (in response to bleathem)I've found the error in the code. The onChanged event lacked the letter "d". This is the end code working properly. Thanks for the help.
<rich:calendar id="startDate" value="#{taskBean.newTask.startDate}" datePattern="dd/MM/yyyy">
<a4j:support event="onchanged" action="#{taskBean.changeEndDate}" reRender="endDate"/>
</rich:calendar>
<h:outputText value="#{m.task_endDate}" />
<rich:calendar id="endDate" value="#{taskBean.newTask.endDate}" datePattern="dd/MM/yyyy">
</rich:calendar>
Greetings.