Re: Struts 2 and DateTimePicker tag
Hi , I am using struts2 datetimepicker in my appln. I want to change the size of the dates in the calender. Can anyone suggest me wid the solution please? -- View this message in context: http://struts.1045723.n5.nabble.com/Struts-2-and-DateTimePicker-tag-tp3488506p4505299.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts 2 and DateTimePicker tag
I'm having trouble in validating datetimepicker. Tried Using required=true but doesn't get validated can u kindly help to go about the same ... And one more doubt difference between sx:datetimepicker and s:datetimepicker ... Cheers Vikpan -- View this message in context: http://www.nabble.com/Struts-2-and-DateTimePicker-tag-tp14239582p21602655.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts 2 and DateTimePicker tag
Thanks a ton for your reply Jeromy... Finally I got it working... :-)... Regards, Jugal -- View this message in context: http://www.nabble.com/Struts-2-and-DateTimePicker-tag-tp14239582p14277652.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 and DateTimePicker tag
Hi Jeromy, Thanks a lot for your reply. I am exatcly doing the same way as suggested by you.. but now I am not able see the datetimepicker tag... Here is the snippet of the code that I am using: head script src=%=request.getContextPath()%/scripts/dojo.js type=text/javascript/script script language=javascript function calculateEndDate() { startDate = document.forms[0].elements['leasingStartDate.value'].value; alert(startDate); } function init() { var datePicker = dojo.widget.byId(leasingStartDate); dojo.event.connect(datePicker, onchange, calculateEndDate); } dojo.addOnLoad(init); /script s:head theme=simple/ /head body style=margin-left: 31%; width: 388%; s:form id=fm_form action=requisition theme=simple name=fm_form method=POST s:datetimepicker onchange=calculateEndDate() id=leasingStartDate displayFormat=dd.MM. / /s:form /body Kindly let me know what am I missing out here... Thanks, Jugal -- View this message in context: http://www.nabble.com/Struts-2-and-DateTimePicker-tag-tp14239582p14249105.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 and DateTimePicker tag
The order of javascript is important. I believe in your case you haven't imported all the required dependencies before trying to call a dojo function. Try this: Put: s:head theme=ajax/ BEFORE you use the dojo-dependent javascript in the head. If you only want to use the simple theme, then manually import all the required dojo files using the code in head.ftl. (eg. you need dojoRequires.js among others). I suspect in your code below, dojo.addOnLoad(init) is throwing an exception and this occurs before the javascript that loads the dependencies for the datapicker can be executed (thus, none of the datepicker dependencies are loaded). It should look like this: head s:head theme=simple/ script language=javascript function calculateEndDate() { startDate = document.forms[0].elements['leasingStartDate.value'].value; alert(startDate); } function init() { var datePicker = dojo.widget.byId(leasingStartDate); dojo.event.connect(datePicker, onchange, calculateEndDate); } dojo.addOnLoad(init); /script /head Take a look at the generated HTML and you'll understand what I mean. Regards, Jeromy Evans Jugal wrote: Hi Jeromy, Thanks a lot for your reply. I am exatcly doing the same way as suggested by you.. but now I am not able see the datetimepicker tag... Here is the snippet of the code that I am using: head script src=%=request.getContextPath()%/scripts/dojo.js type=text/javascript/script script language=javascript function calculateEndDate() { startDate = document.forms[0].elements['leasingStartDate.value'].value; alert(startDate); } function init() { var datePicker = dojo.widget.byId(leasingStartDate); dojo.event.connect(datePicker, onchange, calculateEndDate); } dojo.addOnLoad(init); /script s:head theme=simple/ /head body style=margin-left: 31%; width: 388%; s:form id=fm_form action=requisition theme=simple name=fm_form method=POST s:datetimepicker onchange=calculateEndDate() id=leasingStartDate displayFormat=dd.MM. / /s:form /body Kindly let me know what am I missing out here... Thanks, Jugal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 and DateTimePicker tag
Thanks for your reply Jeromy.. I have made changes according to the inputs provided by you... After change my JSP looks something like this... head s:head theme=simple debug=true/ link href=%=request.getContextPath()%/css/fm.css type=text/css rel=stylesheet script type=test/javascriptdjConfig = { isDebug: true };/script script src=%=request.getContextPath()%/scripts/ajax.js type=text/javascript/script script src=%=request.getContextPath()%/scripts/prototype.js type=text/javascript/script script src=%=request.getContextPath()%/scripts/scriptaculous.js type=text/javascript/script script src=%=request.getContextPath()%/scripts/dojo/dojo.js type=text/javascript/script script type=text/javascript dojo.require(dojo.widget.*); dojo.require(dojo.event.*); /script script type=text/javascript function submitForm() { document.forms[0].submit(); } function calculateEndDate() { alert(Calculating...); startDate = document.forms[0].elements['leasingStartDate.value'].value; alert(startDate); } function init() { var datePicker = dojo.widget.byId(leasingStartDate); dojo.event.connect(datePicker, onchange, calculateEndDate); } dojo.addOnLoad(init); /script /head But still I am not able to invoke an onchage event on datetimepicker... Also when i set the dojo in debug mode.. I get the following error.. FATAL exception raised: Could not load 'dojo.debug'; last tried '__package__.js' Kindly help me out on this... Thanks and Regards, Jugal -- View this message in context: http://www.nabble.com/Struts-2-and-DateTimePicker-tag-tp14239582p14251890.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 and DateTimePicker tag
Jugal wrote: Thanks for your reply Jeromy.. I have made changes according to the inputs provided by you... After change my JSP looks something like this... head s:head theme=simple debug=true/ I recommend using the ajax theme until everything works, then step backwards to simple. It's too easy to miss something if you do it by hand. Try to minimize the possible causes of errors. script type=text/javascript dojo.require(dojo.widget.*); dojo.require(dojo.event.*); /script script type=text/javascript function init() { var datePicker = dojo.widget.byId(leasingStartDate); dojo.event.connect(datePicker, onchange, calculateEndDate); } As per my original email, I'm quite certain the event's called onValueChanged in this version. onchange is actually a DOM event whereas connect is using dojo's AOP's features to intercept a call to the onValueChanged function of the widget. Big difference. So you're back to this: function calculateEndDate() { alert(Calculating...); startDate = document.forms[0].elements['leasingStartDate.value'].value; alert(startDate); } function init() { var datePicker = dojo.widget.byId(leasingStartDate); dojo.event.connect(datePicker, onValueChanged, calculateEndDate); } Note I've used a function reference rather than calculateEndDate. If you're using Struts2.0.x you are using Dojo 0.40. If you're using Struts2.1.x you're using Dojo 0.43 The event API for 0.43 (similar to 0.40) is at http://download.dojotoolkit.org/release-0.4.3/dojo-0.4.3-src/api/#dojo.event You'll find more examples by googling the Dojo Datepicker. While we're on the topic, you may prefer to read the value from the widget rather than try to get it from a form element: replace: startDate = document.forms[0].elements['leasingStartDate.value'].value; with: var datePicker = dojo.widget.byId(leasingStartDate); startDate = datePicker.getValue(); // or datePicker.getDate() if you want a Javacript date rather an a string But still I am not able to invoke an onchage event on datetimepicker... Also when i set the dojo in debug mode.. I get the following error.. FATAL exception raised: Could not load 'dojo.debug'; last tried '__package__.js' That probably means a file is still missing. It's best to use s:head theme=ajax until it works and then try to convert it to simple. Use Firebug to debug these errors. It'll show the 404 and/or the source of the javascript error. regards, Jeromy Evans - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 and DateTimePicker tag
Jugal wrote: Hello All, I am using Struts 2.0.11 for development of my application. I am using datetimepicker tag and I want to trap onchange event of datetimepicker tag. After exploring for a while I found that there is already a https://issues.apache.org/struts/browse/WW-1867 bug raised for the issue. So as per the solution mentioned I am using the valueNotifyTopics instead of onchange attribute to trap the event; but using valueNotifyTopics gives me compilation error for my jsp saying that attribute valueNotifyTopicsis invalid according to struts-tags.tld. After checking the tld, I found that there is no such entry for this attribute. Also the use of this attribute is mentioned in the docs provided along with the 2.0.11 distribution. I have been searching on this for quite a while, but not hitting on any solution. Can any one please throw me some light on this? Do I need to do some special configuration to get this working? Any help is appreciated. Thanks and Regards, Jugal Hi Jugal, The Struts2.0x datatimepicker is a Dojo 0.4x DatePicker widget of type dropdowndatepicker. Once you get a reference to the widget you can access Dojo's event model. The javascript below will lookup a datepicker with id myDatePickerId and connect myListener to its onValueChanged event: function init() { var datePicker = dojo.widget.byId(myDatePickerId); dojo.event.connect(datePicker, onValueChanged, myListener); } dojo.addOnLoad(init); The dojo.addOnLoad(init) line ensures the init function is called when the page is loaded. regards, Jeromy Evans - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]