Comments (5)
I've added in the option for a property to be required now. After implementing it, I looked through the code and found some references to "mandatory" validation - but I can't see where this is used at all or how one would go about setting a property up to be mandatory.
Was this a feature that was never fully implemented or have I just reinvented the wheel?
For reference (and anyone interested in implementing it too) I have added a Required checkbox to the parameterconfig.prevalues.html file binding to property.value.required. And then in the parameterconfig.controller.js inside the property loop within $scope.isValid
i've added:
if (property.$editor.required && property.value == null) { isValid = false; property.error = "This field is required"; return; } else { property.error = null; }
I then output this below each property in parameterconfig.html:
<div ng-if="property.error">{{property.error}}</div>
I haven't created this as a pull request because I'm still unsure as to whether this functionality is new and perhaps I've just not figured out how to activate it?
from leblender.
@tomeglenn a PR would be grealy appreciated
We have talked about this a bit, but not really found a good solution yet
from leblender.
@tomeglenn Can you please provide me with some more details on exactly what you changed to do this? I have tried but it just errors or are there different changes to make it work in the latest version of LeBlender & Umbraco?
from leblender.
Hi @jacklawry ,
Apologies for the delayed response. I never saw @soreng's request to make a PR, apologies.
I don't have a fork of LeBlender setup on my machine but I do have the commit log from when I implemented the functionality so I will explain it below.
App_Plugins/LeBlender/editors/leblendereditor/dialogs/parameterconfig.controller.js
Find the following if statement
if (!property.$valid)
...
}
Directly after that if statement closes, add a new one containing the following.
if (property.$editor.required && property.value == null) {
isValid = false;
property.error = "This field is required";
return;
} else {
property.error = null;
}
App_Plugins/LeBlender/editors/leblendereditor/dialogs/parameterconfig.html
Find this line:
<blender-editor-wrapper property="property" item="item"></blender-editor-wrapper>
Directly after it add this line:
<div ng-if="property.error">{{property.error}}</div>
App_Plugins/LeBlender/editors/leblendereditor/dialogs/parameterconfig.prevalues.html
Find this section:
<umb-control-group label="Description" description="">
...
</umb-control-group>
Directly after that, add this:
<umb-control-group label="Required" description="">
<div style="text-align: left">
<input type="checkbox" ng-model="model.value.required" />
</div>
</umb-control-group>
You should now be able to go into your LeBlender properties editor and mark fields as required.
Hope this helps.
from leblender.
This is now working thanks @tomeglenn!
from leblender.
Related Issues (20)
- Need to cache call to PluginManager.Current.ResolveTypes
- How to get value from Umbraco.DropDown.Flexible HOT 1
- Need a reliable way to detect whether a node has been saved within a leblender partial
- Preview doesn't work if requesting node by guid instead of id
- Changes to grid.editors.config.js file can be lost in Umbraco Cloud HOT 2
- Umbraco V8 Support HOT 49
- Regarding LeBlender HOT 1
- Umbraco Security Hardening With Leblender HOT 2
- Partial grid editor being returned from Umbraco backoffice HOT 1
- Custom properties broken? -- 1.0.9.2 (from NuGet) on Umbraco 7.7.7 HOT 4
- When a new property is added to a LeBlender grid editor, it breaks editing HOT 6
- No input fields visible after fresh install on Umbraco 7.9.2 HOT 3
- LeBlender injects Bootstrap Styles into Backoffice HOT 3
- Caching shows first editors content in all other editors place HOT 6
- Links in admin tree is not working after few clicks with leblender 1.0.8.4 HOT 1
- LeBlender Editor top-level property on whole set of items HOT 2
- Cache by member HOT 7
- Confusing property editors HOT 5
- Automate deployment
- Cell / Row config HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leblender.