Forms - Dependent Field Not populating with update

Kaushik Patel asked on April 15, 2019 12:15

I have two dropdown on my form. For Parent & Child. Parent Drodown filled by :

SELECT [ParentID],Title FROM (SELECT NULL ParentID, '{%GetResourceString("Parent", QueryString["culture"].ToString()==""?QueryString["parentculture"]:QueryString["culture"])#%}' as Title, 0 AS SORTORDER UNION SELECT DH.ParentID, DH.TITLE, 1 AS SORTORDER FROM View_CMS_Tree_Joined_Publish V INNER JOIN K_Parent DH ON V.DocumentForeignKeyValue=Dh.ParentID
WHERE V.ClassName='K.Parent' AND V.DocumentCulture = '{%currentCulture%}' AND V.Published = 1) AS FOO ORDER BY SORTORDER, Title

Parent dropdown set as "Has Dependent Fields" == true.

Now the Child Dropdown set to dependent on another field = true. Also i have to bind dropdown for selected parent. but the child dropdown does not updated as per parent selection.

SELECT [ChildsID],Title,Parent FROM (SELECT NULL ChildsID, '{%GetResourceString("Child", QueryString["culture"].ToString()==""?QueryString["parentculture"]:QueryString["culture"])#%}' as Title,'' Parent, 0 AS SORTORDER UNION SELECT DD.ChildsID, DD.TITLE, Parent, 1 AS SORTORDER FROM View_CMS_Tree_Joined_Publish V INNER JOIN K_Childs DD ON V.DocumentForeignKeyValue=DD.ChildsID
WHERE V.ClassName='K.Childs' AND V.DocumentCulture = '{%currentCulture%}' AND V.Published = 1 AND (Parent = '{%Parent.Value#%}' or '{%Parent.Value#%}' = '') ) AS Childs ORDER BY SORTORDER, Title

Please let me know how can i achieve this.

Recent Answers


David te Kloese answered on April 16, 2019 13:00

Where did you test it? On live site or in the preview?

check if it works in the admin interface (so you don't have any other custom html, script or styling involved): Image Text

Does it not respond to a change, or do you get wrong/unexpected data?

Any errors? Check for script errors in your browser, or perhaps in the Kentico Event log?

Make sure the naming of the field is correct when referencing the parent value from the child dropdown!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.