what is the the right script that i can use to hide or show these controls above, usually i use this code in parent form and it work for me:
//for hide
$(fd.field('PersonHasChildrens').$parent.$el).hide();
$(fd.field('PersonChildrensCount').$parent.$el).hide();
//to show
$(fd.field('PersonHasChildrens').$parent.$el).show();
$(fd.field('PersonChildrensCount').$parent.$el).show();
now i need to use the same code but from the subform/child form in order to show or hide controls in parent form
i tried to add: "window.top" like this but it seems not correct:
//to show
$(window.top.fd.field('PersonHasChildrens').$parent.$el).show();
$(window.top.fd.field('PersonChildrensCount').$parent.$el).show();
Hello dear @mnikitina,
really thank you for your help, the second option is simplified and very nice.
One more Question please
is it enough to use this below script inside a function in order to check if a lookup control is ready, or do i need to do something else?:
-'PersonMaritalStatus' is a lookup field for a list contains Marital status types (data are fixed no changes will be made on this list).
'ArrMaritalStatusSubToHide' is an array already declared and contains multiple integers ID like: 2,3,6,9...
These IDs are selected from the Martial status types list to check if the lookup value will match one of those IDs if matched i will call a function to show some controls if else i will call another function to hide controls.
First request kindly I need to be sure that i am writing the right script to check if the lookup field 'PersonMaritalStatus' is ready in the parent form, from the sub form or i need to change this:
Window.top.fd.field("PersonMaritalStatus").ready().....
Secondly, I tried to debug my scripts as i see the problem is with the Lookup field value.
Sometimes this script works with any lookup field:
($.inArray(window.top.fd.field('PersonMaritalStatus').value.LookupId, ArrMaritalStatusSubToShow) !== -1)
If not i need to change to this script:
($.inArray(window.top.fd.field('PersonMaritalStatus').value, ArrMaritalStatusSubToShow) !== -1)
You can check the difference above between
fd.field(Lookup).value.LookupId
And
fd.field(Lookup).value
somtimes none of those works too so i used this below and it worked:
fd.field(Lookup).value.ID
It should be 1 right solution/script to get a straight Lookup value.