Show/hide field depending on value of other field March 24, 2023, 12:28:40 PM Hello everyone,I need to show/hide fields depending on the selection of a previous value …Example:Table: Membermem_id,mem_namemem_gendermem_maritalstatusmem_anniversarydatemem_addressmem_areaidWhen selecting "Married" in mem_maritalstatus, it should show mem_anniversarydate (as required field) and if in mem_maritalstatus "Unmarried" is selected, it should hide mem_anniversarydate. If the status is edited from "Married" to "Unmarried" the mem_anniversarydate should be cleared.Secondly, I want to show data from other table in Add/Edit mode. Custom fields are disabled in Add/Edit mode.Eg:Table: Areaarea_idarea_namearea_ziparea_stateTable: Membermem_id,mem_namemem_gendermem_maritalstatusmem_anniversarydatemem_addressmem_areaidI'm storing the mem_areaid from area table and need to show the corresponding city and zip of the area as well in the Member table when adding/editing data.How can this be done?Thank you. Quote Selected
Re: Show/hide field depending on value of other field Reply #1 – March 26, 2023, 10:08:26 AM Use Add Page Field Properties -> ClientEvents to write jQuery code to help you archive that. Double clicking on one of the samples on the left panel should show you sample jQuery codes. Archiving this requires you have a knowledge of jQuery. Quote Selected
Re: Show/hide field depending on value of other field Reply #2 – April 04, 2023, 02:21:43 PM Your short answer was tried and tested but it does not seem to work as required.$('#ctrl-mem_maritalstatus').on('change', function(){ if($(this).val() == 'MARRIED') { $('#ctrl-mem_anniversarydate').show(); $('#ctrl-mem_children').show(); } else { $('#ctrl-mem_anniversarydate').hide(); $('#ctrl-mem_children').hide(); } });This code hides the mem_children field when 'MARRIED' status is selected. The label is still visible.What needs to be done is:1) When the form loads, the mem_anniversarydate and mem_children along with the respective labels should be hidden. They should only be visible when the option in mem_maritalstatus is selected as 'MARRIED' and they should be set as required field.2) The second question regarding custom fields in Add/Edit forms is still unanswered.Please help. Quote Selected Last Edit: April 04, 2023, 02:34:50 PM by bhavin