From: Hans O. <han...@gm...> - 2014-04-29 11:24:31
|
Hi Bernhard, indeed Stephans recommendation is good, to use replacetext so simply generate Birthyear-Fields all over the wiki. This way there would be no need to preload default etc. However, it seems to me the other way (that you intend) is working as well in my (non public) SMW. I understand Stephan says this is a bug (why? It's neat!), but it works fine for me. I integrated a small hand written ticket tracking system with SF. It has a field "target date" that the user may edit (so that others can see the currently likely date of accomplishment). At some point I decided to add a field "target date (original)" as a little psychological motivation for users to not overstress the option to reset the clock (everyobdy can now see what the original scheduling was). Works very well, by the way... Anyhow, I needed to set this field even in existing tickets. So I did two things. In the corresponding template: If no entry for "target date (original)" exists, the normal target is rendered (both are identical - ok.). In the form I am using this: {{{field|Zieldatum (ursprünglich)|default={{#show: {{PAGENAME}} | ?Zieldatum_aktuell#ISO}} }}} {{{field|Zieldatum (aktuell)|mandatory|default={{#time: j.n.Y | now +6 weeks }}|input type=datepicker }}} In other words: If the new "target date (original)" field "Zieldatum (ursprünglich)" does not yet exist in the data, take the normal "target date" field "Zieldatum (aktuell)" and use it as default. And indeed, when opening an existing ticket page that does not yet have the new field set, the edit form displays default values taken from another field. I am not sure what is not working in your case. However it seems odd to me that you default the field value to itself (Birthyear), as this is just the new field that you want to pre-populate. Should it not be something like {{#time: Y | {{#show: {{PAGENAME}} | ?Birthdate#ISO}} }} ? Best, Hans 2014-04-29 12:22 GMT+02:00 Krabina Bernhard <kr...@kd...>: > > Default values are (should be) taken into account by SF for newly > > created pages only. If anything shows up on already existing pages > > (even if the respective field is empty), that's a bug. > > Well actually I don't want to have default values, I'd like the values > that have already been set to show up in the form fields, but > unfortunately, this does not seem to work.... > > - Bernhard > > |