Is there any way to specify the default value for a field in the ds.xml so that when a new record is initialized for a DynamicForm or ListGrid row the initial value for the field will be set? In this particular case it is a date field.
Announcement
Collapse
No announcement yet.
X
-
Nice to know about that, but I don't think it is what I'm looking for. In this case I want the default value to appear in a DynamicForm when a new record is being edited. I'm using a reusable component for the editor UI so I want to keep the default value in the ds.xml rather than having the "generic" editor include code for specific datasource fields.
Comment
-
Did I stumble across an undocumented feature? All I've done so far is add defaultValue="Something" to my field in the ds.xml and the DynamicForm shows that value when a new DynamicForm is created.
Is there any way to make the defaultValue the current date?Last edited by jay.l.fisher; 27 May 2010, 07:13.
Comment
-
Originally posted by IsomorphicYes, use <value fieldName="fieldName" value="value"/> in an operationBinding.
If I create such a DataSource with a value in an operationBinding of type "add", and call form.editNewRecord() on the form, will those default values show up on the fields in the form?
I thought operationBindings aren't hit until you actually call them via e.g. form.saveData() in which case these values would only be seen by a user after the actual add to the backend.
Is that correct?
Comment
-
Yes that's exactly right - the initial suggestion - using a <value...> tag in an operation binding - would provide a default value when a value was saved to the server only -- it wouldn't show up in the editor as a defaultValue.
As suggested above - if you want a custom value to show up as a default in your editor you can apply some arbitrary attribute to your dataSourceField and have your editor pick up this value in your client side code.
Comment
Comment