-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
common formulas without coding (via helpers) #618
Comments
We have always tried to keep the amount of field properties as low as possible, considering most of the config settings a user can need can be implemented through formula. That's the Plomino approach.
|
I have an idea might combine with the plomino approach. What if there was a way to create a code generator for a formula?
This way no more options need added and this could apply to lots of different kinds of formulas, not just validation for instance like action adaptors in PFG. In addition this could be done TTW using plomino itself. You could create a special plomino form which asks the options and has a calculated field to generate the code (and some libraries to make this easy). This means coders could build things that make it easier for designers to help build applications. Not sure how to combine it with HTML5 attributes. A validator generator would have to change both the template and the attributes at the same time. Maybe a given generator could control multiple fields on a given object not just a single formula? Not sure how to handle combining formulas togeather. Both action adaptors and validators in PFG have the ability to have multiple selected. It's very helpful to be able to both email the form results and save to the database at the same time. or email multiple people. or validate if a field is both valid postcode and between 2000 and 2999. |
oh and @jean also suggest you could have a mode where you edit the generated code. so it would be a way into coding more perhaps if you had that level of permission. |
It sounds like an excellent idea. ## GENERATED CODE FOR <the_feature_name> START
# you can change this code, but it will break the generator compliancy
<our generated code>
## GENERATED CODE FOR <the_feature_name> END That way we can easily make sure we do not override manually changed code, we can easily concatenate several generated sections, etc. |
I was thinking some kind of naming convention for forms that are meant to generate code instead of be used in the application. This way we don't need an extra kind of registration. Not sure what the convention would be. Still not sure on how to combine a validator rule that injects html attributes as well as code to test the value. If we injected values into the HTML attributes injection field then how can we remove it again? Thats harder to combine with others. Perhaps the on save event can manipulate other fields so its done on a case by case basis. |
One refinement that I thought of is that instead of result is a generated formula saved in the formula field, the default result is a reference to the rule instance. Only when customized is the generated formula copied to a rule object for the current field. (I'm imagining that instead of event and validation formula properties on forms and fields, we have event/validation/rule objects and lookups. Look at rules listed in order in a (This idea should work for fields also --- instead of forms only seeing contained fields, make available referenced fields for placing on the form.) |
not sure about the references thing yet. But in terms of code generation I think it makes sense in terms of the UI that a "formula helper" is picked for a whole form or field or action rather than on a specific fomula field. Users might not know which formula they are meant to look at. This way a given helper can target multiple formulars/settings at once if enabled (such as html attribute injection). It would kind of be like DX behaviours. |
Some clarification and expansions.
== Clarifications ==
== Expansions == Currently the content model of Plomino is (from a design perspective):
I want to look mainly at Forms / Fields. Forms supply layout, fields, validation, and events. (Fields also supply This makes it very hard to see what's happening, to make sure the right checks What I would like to do is to hoist these formulas out into objects as well, so Now, how are the relevant formulas found and applied? At the moment, a form mainly operates on contained fields (ignoring subforms for now). I would like to add a summary view to a form so that it lists not only I propose that formulas are differentiated based on naming. When you add This should not be mysterious: when looking at the form summary, we should see
When looking at the field, we should see the The same goes for event formulas: all found formulas starting with I think that forms should be able to store a local ordering of found formulas, If you looked at the summary view of a form, it would list:
You would start a new form for this category of documents, or this type of That's similar to what you do now, but instead of ending up with many copies of Form validation formulas would be named At the moment every field has a property for a validation formula. That way they can share validation formulas. There's no need to add and correctly name everything by hand .. there should be UI |
#705 Contains a potential mockup of option 3, the helper idea.
|
I don't know if z3c.form is the right approach here. |
@ebrehault In that case the simplest option is using plomino itself. It's an optimisation to allow installing via eggs and one that perhaps we won't need. So perhaps how you create a helper is
Might be nice if the helper DB could optionally be in the control panel somewhere as its not neccerily end user facing. |
@ebrehault Seems like implementation would depend on #726 and #618. Waiting to see if there is movement on those. |
@ebrehault added a plan |
@ebrehault progressing well. I;m going to have a setting in the db object to specify which db's to import helpers from. Seems more secure than id conventions. The helpers themselves will still use an id convention. |
user problem
A form designer wants to be able to specify simple validation rules without knowing code. It should be possible for them. Several out of the box rules should be available. Some would need to be configured such as ranges. It should be possible to use many at the same time. It should be possible for someone else in the same app to define custom rules which form designers can apply to certain fields.
This also applies to hidewhens, and save formulas too. A very common form of hidewhen is to hide a section until a certain option in a radio or checkbox is picked.
options
Plan
Do helpers as follows
Specific example helpers to implement
Future
The text was updated successfully, but these errors were encountered: