[MAGNOLIA-231] Should be possible to clear date Created: 05/Dec/04  Updated: 06/Dec/04  Resolved: 06/Dec/04

Status: Closed
Project: Magnolia
Component/s: admininterface
Affects Version/s: 2.0 Final
Fix Version/s: 2.01

Type: Improvement Priority: Major
Reporter: Michael Aemisegger Assignee: Vinzenz Wyser
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

any


Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

When trying to clear the date field, the browser complains:

'Date must be of format ...'

which is good, if you really want to add a date. But if you want the date field to be optional, it should be possible to clear the date again.

Suggestion:

  • add 'clear' or 'remove' button which deletes the date node. Like this the <cms:ifNotEmpty> tag could work as expected.


 Comments   
Comment by Michael Aemisegger [ 05/Dec/04 ]

There are circumstances under which the date node does exist but is empty. In this case DialogDate throws a NullPointerException:
2004-12-05 18:32:07,386 [http-8180-Processor23] DEBUG jsp - Lack of configuration - not able to render dialog control
java.lang.NullPointerException
at info.magnolia.cms.gui.dialog.DialogDate.init(DialogDate.java:63)

Adding a test on null helps:
if (this.getWebsiteNode()!=null && this.getWebsiteNode().getNodeData(this.getName()).isExist()) {
Calendar valueCalendar=this.getWebsiteNode().getNodeData(this.getName()).getDate();
if ( valueCalendar != null )

{ Date valueDate = valueCalendar.getTime(); SimpleDateFormat sdf = new SimpleDateFormat(format); this.setValue(sdf.format(valueDate)); this.setWebsiteNode(null); //workaround so the value is taken... hm, pfusch }

}

Comment by Vinzenz Wyser [ 06/Dec/04 ]

alert removed when value is empty

Generated at Mon Feb 12 03:15:23 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.