Support » Plugin: Pods - Custom Content Types and Fields » Hide field depending on input

  • Resolved tohinisishi

    (@timtimtim1)


    I have 3 fields setup but i only want to show field 2 when field 1 have data and so on. is this possible?

Viewing 5 replies - 1 through 5 (of 5 total)
  • it is. you can use javascript to make your own “visibility-logic”.
    e.g.

    jQuery('.pods-form-ui-row-name-you-want-to-hide-here').hide(); 
    jQuery(document.body).on('change', '.pods-form-ui-field-name-which-should-trigger', function() {     
    	if (jQuery(this).val() == 'your-val') {
    		jQuery('.pods-form-ui-row-name-you-want-to-hide-here').show()
    		} else {
    			jQuery('.pods-form-ui-row-name-you-want-to-hide-here').hide().val('')
    			}; 
    		});

    Thanks for reply.

    I tried the code and it “works” but not the way i was expecting.

    So i have 3 forms pods-form-ui-pods-field-test, pods-form-ui-pods-field-test2, pods-form-ui-pods-field-testip3.

    On intial page load the pods-form-ui-pods-field-test is the only form visibile. if its not empty the pods-form-ui-pods-field-test2 is visible. if its not empty pods-form-ui-pods-field-test3 is visbile.

    And in reverse:

    When pods-form-ui-pods-field-test3 is empty it will be hidded but the other 2 will show, when pods-form-ui-pods-field-test2 is empty. only pods-form-ui-pods-field-test1 will be visbile.

    Plugin Author Jory Hogeveen

    (@keraweb)

    You can modify the above function according to your needs in terms of showing/hiding fields. Just add extra selectors! 🙂

    tohinisishi

    (@timtimtim1)

    Thanks but i cant get it to work, i have 3 fields and whatever i do i get the wrong combination. any help would be highly appreciated.

    irashwan

    (@irashwan)

    where to add this js code?

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.