dependent depends on dependent

edited August 2016 in Modules
Hi,

We have a module with four fields (A B C D), A is a select type, B depends on A, C depends on B, D depends on C. These work fine when creating, however when the data is loaded, only fields A and B are populated with values.

The values are entered into the database as expected, i think the problem lies with a dependent field depending on a dependent field. Is there a way of populating a dependent field that depends on a dependent?

My colleague has created a work-around that works as follows: in the form_fields method, check if $values is set, if it is, fetch the values for C and D and then create select field types for C and D, but this detaches the C on B, D on C dependencies.

Thank you for any help.

Andy

Comments

  • edited 1:44PM
    Ive figured this out.

    You can treat a dependent like a select type. In the form fields method, if $values is set, get the values for field D and set using the 'options' attribute.

    This also auto populates field D.
Sign In or Register to comment.