-
Notifications
You must be signed in to change notification settings - Fork 4
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
Allow setting default values in the quick form using url params #9
base: 2.x
Are you sure you want to change the base?
Conversation
I wonder if we could leverage the new "configurable quick forms" concept that will be included in farmOS v2.2.0 instead. That will allow this quick form to be made "configurable", which means we can declare configuration for it (such as default values), and save that to configuration entities. This will also allow multiple "instances" of the quick form to be created (eg: one for each set of configuration that you want), and there can be multiple dedicated URLs for each quick form configuration (eg: /quick/eggs1, /quick/eggs2, etc). Would that accomplish the same goal, I wonder? |
If the goal is to set static default values, then creating configuration sets for them could work. Although, depending on the amount of the configuration sets needed, just having a single form instance with the ability to dynamically override defaults may be more convenient than creating multiple instances where each one has a different url and menu item. Another use case that query param based default values overrides could be useful would be to create some dynamic links/actions for use in the context of assets designated as laying eggs. |
I'm currently using this for adding 'Record egg harvest' actions in a few places:
|
@wotnak I've been meaning to follow up on this (I have it marked unread in my inbox so I don't forget). I agree this would be a good addition. What I'm thinking now is: it would be great if we could solve this in a generalized way. I brought this up on a call with @paul121 today and an idea emerged... Currently farmOS includes a So what if we add a new Notably, @paul121 pointed out that So, we could also consider a followup PR here that adds a "Record egg harvest" bulk action, and it would be a simple next step. Although maybe there are other considerations there (we don't want that showing up on all asset types, for instance). What do you think about this idea @wotnak? |
Adds option of setting default values in the quick form using url params. This can be useful for creating an action or link for a specific asset that will redirect to the egg harvest quick form with the asset preselected. It can also be used for example to generate qr code that can be printed and placed next to a specific chicken coop that will open the egg harvest form for a specific flock.
Supported url params:
assets=<id>,<id>,...
quantity=<number>