Home>Support>Conditional fields based on checkboxes and selects.

Conditional fields based on checkboxes and selects.

Hi there,

I’m trying to integrate the SiteOrigin Page Builder with my plugin and came across a problem. I’ve added a few fields to the row styles using the “siteorigin_panels_row_style_fields” filter found here: https://siteorigin.com/docs/page-builder/hooks/custom-row-settings/, but I can’t seem to use the state emitters and state handlers. Are these only available for the Widgets Bundle? And if that is the case, how can I target these fields in JS? I’ve tried binding a change event, but it never seems to work. Would I have to call this with an event? For example, if I wanted to do something like this:

$('select[name="style[test_field]"]').bind('change', function (e) {
  if( $(this).val() == 'option1' ) {
    $('input[name="style[second_field]').hide(500);
    $('input[name="style[third_field]').show(500);
  } else {
    $('input[name="style[second_field]').show(500);
    $('input[name="style[third_field]').hide(500);
  }
});

How would I achieve this? I would appreciate any feedback. Thanks!

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More