- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Default value for a text component
How we can add a default value to an input in markup pattern area or can we add a new field to "Component Details List" area like "Label Override" or "Message Field" after creation of a new markup ?
For example;
{Show_Default : Text : "Default value"}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You're not able to provide something directly in the markup. But you could provide a default value in code by editing the Components_Text.cs file (assuming you have a component called "Test") and on the ComponentInput method, before the call to InputBase you could do something like:
if (string.IsNullOrWhiteSpace(asset["field"])) asset["field"] = "Default value";
This would set the default for a field called "field". Note that it would also remove the user's ability to clear the value and save, as it would be restored next time that they edit.
Can this do what you're looking for?
Regards,
RIchard.

