Odoo Pass a dynamic list to View - view

I want to filter many2one field using a domain in the create view. What I'm trying is send a list to the view as a functional field and use it in the domain. (That list will change according to user) It will look as follows,
<field name="filter_ids" invisible="True"/>
<field name="department_id" domain="[('id','in',filter_ids)]">
What type of functional field should I use for this purpose?
Or any idea to dynamically change (one user to another) the domain of a many2one field?
I tried many ways using on_change, fields_view_get and so many others. On_change calls on load but it doesn't filter values onload. fields_view_get add the domain but it apply for all form views including update view which should not happen according to the requirements. please help :)

1-You can use fields_view_get then
2- set
so you don't get the field in your edit view
3- use another field which should behave as you want it on the edit view

Related

Laravel: A field that lookup another field from different table

I use Backpack for Laravel.
I know that to add a field, we can use:
CRUD::addField(['name'=>..])
But, I don't know how to add a field that lookup another field input from different table to show a lookup value.
Please look at the illustration below.
Thanks.
Edit:
I found a temporary solution to this, but not effective.
Reference: https://backpackforlaravel.com/docs/4.1/crud-how-to#add-a-select2-field-that-depends-on-another-field
With select2_from_ajax you still have to select the option (even its just one option left), meanwhile what I really want is its automatically select that one option.
It's depends on what you need to do. You can use relationship field and show a select with the list of user. If you really wanna do it like this. You can probably make an ajax request to show it. In that case you ll need to use a custom view for the edit or the create view.

Joomla Component Dynamic Custom Field based on other Field Value

I am creating a new Joomla Component. I am able to create custom fields for the component backend forms - but I am not able to create Dynamic Custom Fields.
What I would like to do is have a field that is dynamical populated based on the value of a previous field. The easiest way to explain this is the simple country,state,city breakdown.
Field 1 = Country
Field 2 = State (Based on what the user selected as as Country in Field 1)
Field 3 = City (Based on what the user selected as State in Field 2)
The fields would of course need to be refreshed, reset as the user picks a different country etc.
The data to populate the fields would also all need to come from a database based on the previous fields value.
I am guessing this needs to be done via ajax or javascript or something? But wondering if there is an official way? Especially since there are database calls involved.
Please let me know if there is anything I can explain better..
David
I ended up just creating text fields but then validating the input to make sure the values added are correct.

Can we prepopulate the webform fields with values in webforms for marketers?

We have a requirement to pre-populate the Contact Form with user information on load if the user is a logged in user. So that, user need not fill his information using the webform.
Is there any way to do this using webforms for marketers?
Data is coming from a service api in json format. Need to figure out a way to bind it to fields either in server side or in client side.
Sitecore Version 7.1 140117 WFFM Version "Web Forms for Marketers
2.4.0 rev. 140117"
Have a look at Sitecore - Webforms For Marketers Form - Use ReadQueryString Option. Basically, there is a checkbox, ReadQueryString, in presentation details that gives you the option to fill in the default values from the query string. If checked, you use the item names of the fields (not the display name or title) as keys and the values you want to set the fields to as the values in key-value pair in the querystring.
Create a new rule based on use default value from user profile [fieldname] field and amend it to pick up the value from your service API.
This will be your best way and simplest option in my opinion.
I use this same approach prepopulating ucommerce data from its API.
Create custom field and then you can pre-populate values as per your need.
Like if you want to populate any value in Single line text field the create custom field for this and then reflect forms dll and copy code then update code as per your need.
Please check https://sitecoretweaks.wordpress.com/2015/02/20/custom-field-type-for-sitecore-web-form-for-marketers/ blog post for more details.

Binding one NSSearchField's text to two different controller objects

I have two different NSArrayControllers but I'd like to use the text of one search field to filter them both. The predicate would be different for each controller. Is it possible? Right now I can only get it to filter one array controller at a time.
YES this is possible.
You can do it as : This Stack Overflow answer by me shows how to do for one table and ArrayController.
For multiple you just need to add a new predicate, which will say as Predicate2. Please refer the screen shot:
Here Teacher and Student class contains a property name. However yo can have different property name. Also I am filtering only on one column or property you can search it for multiple columns/properties, for this refer the above link.

Dynamically add input boxes to an edit form in joomla 2.5

I followed this tutorial on how to build a component for joomla 2.5, but now I am stuck.
What I want to do:
Besided thoses field defined in admin\models\forms\.xml I want to dynamically add form fields. The field list should be read from database.
I have a:
main table #__tours(id, title),
field list table #__tourfields(id,lable,description,position)
field value table #__tourfieldvalues(tourid,fieldid,fieldvalue)
#__tourfields contains a list of additional fields, that the user may want to specify for each entry in #__tours. #__tourfieldvalues would contain the values for the additional fields.
So now I need to figure out how to add input boxes to the edit form for each row in #__tourfields, read the values in #__tourfieldvalues for the currently to display entry of #__tours.
How can I do this?
This is very complex question. Subject to small book :)
In general you have to create class for every field type and initiate this class for every field in #__tourfields. This class have to extend JFormField and have getInput() method overridden.
Then in cycle you fetch your fields.
Something like this. But I believe you have to have more specific question. This one sounds like "How to create CMS like Joomla from scratch?"

Resources