Set default value using UI Builder from other prop...
# help-with-umbraco
s
Is it possible to set a value from another property?
Copy code
css
tabConfig.Sidebar(sidebarConfig =>
    {
        sidebarConfig.AddFieldset("Advanced", fieldsetConfig =>
        {
            fieldsetConfig
                .AddField(rr => rr.UpdatedAt, fieldConfig => fieldConfig.MakeReadOnly())
                .AddField(rr => rr.CreatedAt, fieldConfig => fieldConfig.MakeReadOnly())
                // Can I make "IsWildcard" true if another property contains "*"???
                .AddField(rr => rr.IsWildcard, fieldConfig => fieldConfig.SetDefaultValue())
                .AddField(rr => rr.SiteId).SetDefaultValue(101);
        });
    });
I want to make the IsWildcard property true if the SourceUrl property is a wildcard (string ends in
*
). I've tried reading through documentation and googling, but I can't seem to find anything. The docs indicate I can pass a function https://docs.umbraco.com/umbraco-ui-builder/collections/editors#setting-the-default-value-of-a-field but I'm not sure how to access the other properties / if is possible
j
You could make the field readonly and then set the value before you save if you use a custom repository
s
No, I don't - but I'm trying out the Events to see if I can do it from there! Great idea
10 Views