Auto-fill a relate field

Hello guys. I have 2 related fields and I need to auto fill the second field after the 1st field have been changed. I am using v7.10.

Do you guys have any idea how to do this?

A couple of questions:

  • exactly in which module, which view, which part of the view (subpanel?) do you need this?

  • do you need the results refreshed on screen, immediately, or is it ok to just update the database? (in this second case, you could just use a Workflow or an after_save logic hook).

Thank you for your reply.

exactly in which module - This is a custom module
which view - editView
which part of the view - form -> fields

This is the case, I have 2 relate fields in my form. In my 1st relate field (customer), after I select a customer, I need to auto fill up the 2nd relate field ( city ). The problem is that, in editviewdefs.php , I added displayParams array under the relate field customer but the only thing I can get from that array is the ID of the CITY, i needed the name so that I can fill it up in the city field.

Please let me know if you have any more questions. Thank you PGR.

You should be able to just use the correct field name in the editviewdefs.

Let’s see how your relationship is set up. If you did it from Studio, you should have files defining it in

custom/metadata

custom/Extension/modules//Vardefs

custom/Extension/modules//Vardefs

Also, make sure this is a one-to-many relationship, otherwise it won’t work.