dateselect.xhtml
2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:tools="http://java.sun.com/jsf/composite/tools">
<composite:interface>
<composite:attribute name="datefield" required="true" />
<composite:attribute name="submitaction" required="true" method-signature="java.lang.String action()" />
</composite:interface>
<composite:implementation>
<h:outputScript target="head" library="script" name="jquery.min.js" />
<h:outputScript target="head" library="script" name="date.js" />
<h:outputStylesheet library="style" name="datePicker.css" />
<h:outputScript target="head" library="script" name="jquery.datePicker.js" />
<h:outputScript target="head" library="script" name="date_fi.js" />
<h:outputScript target="head">
Date.format = 'dd/mm/yyyy';
$(function()
{
$('#currdatePick').datePicker({inline:true#{sessionHandler.hasPermission('CALENDAR_MANAGE')?', startDate: \'01/01/1970\'':''}})
.dpSetSelected($('#dselect\\:dateform\\:dateField').val())
.bind('dateSelected',
function(e, selectedDate, $td)
{
var formatted = selectedDate.asString()
$('#dselect\\:dateform\\:dateField').val(formatted);
var subbutt = $('#dselect\\:dateform\\:sub');
subbutt.click();
}
);
});
</h:outputScript>
<div id="currdatePick" />
<h:form id="dateform">
<h:inputHidden id="dateField" value="#{cc.attrs.datefield.time}">
<!-- date format Fixed for dateselector! -->
<f:convertDateTime pattern="dd/MM/yyyy" />
</h:inputHidden>
<h:commandButton style="display: none" id="sub" action="#{cc.attrs.submitaction}" value="foobar" />
</h:form>
</composite:implementation>
</html>