Hi List,
Consider DateTimeField as a reusable component that displays /
admits
an NSCalendarDate value.
In a wod file, it may appear like
ScheduledTime: DateTimeField {
value = scheduledTime;
timeZone = session.preferedTimeZone;
editable = isEditing;
language = session.language;
......
}
The component takes a value from binding and presents the
value as a value set
(year, month, day,... in specified language/format/locale ),
and takes the updated
value set to update the binded value
accordingly.
Now suppose I put a DateTimeField into a component, say
AdminBox, and embed
the AdminBox in an EventEditor page. Then in AdminBox.wod,
Date Field may
be defined like
ScheduledTime: DateTimeField {
value = ^scheduledTime;
timeZone = session.preferedTimeZone;
editable = ^isEditing;
language = session.language;
......
}
the operator ^ means that its following keyPath is relative to
the parent component
(in our case, AdminBox is supposed to have bindings
scheduedTime and isEditing)
The trouble that I encountered is that when form submitted,
the case where direct
bindings are used worked as expected, but the latter case
(using ^)yields exception:
*** object is unsettable for keyPath
^scheduledTime...
Replace DateTimeField with something simpler like WOTextField,
both cases worked
just fine. This is understandable: In my DateTimeField, I
used
[self setValue: _date forBinding: @"value"]
to set the value with the nornalized date object. But
-(void)setValue:forBinding:
doesn't work well with the operator ^
Any ideas? Thanks in advance
|