Forums

Hiding multiple fields with the Element(s) identifier setting on the events tab of an element

ftpaul 06 Jul, 2018
I want to hide a bunch of fields when someone selected "No" from a radio group. I'm trying to put all the fields that are to be hidden into the same "Element(s) identifier" setting instead of creating a new event for each one. Is that possible? I tried putting # in front of each element and putting a comma after each ID. It never hides anything after the first element or ID that's defined.
healyhatman 07 Jul, 2018
Each element needs to be on a new line.

Note to Max : you very much need to make that clear in the UI
emmexx 26 Dec, 2018
[blockquote[li]Each element needs to be on a new line.[/blockquote][/li]
  • That works in CFv6. In CCv6 the Element(s) identifier field doesn't allow multiple lines.


  • Using events in a dropdown is throwing a jQuery error too:

  • TypeError: invalid 'in' operand e
  • The culprit code is the 2nd line in the below code from g2.forms.js:
  • var event_targets =
  • ;
    jQuery.each(event['identifier'], function(idi, ident){
    if(ident.substring(0, 1) == '#' || ident.substring(0, 1) == '.' || ident.substring(0, 1) == '['){
    event_targets = jQuery.merge(event_targets, jQuery(ident));
    }else{
    event_targets = jQuery.merge(event_targets, jQuery(':input[name="' + ident + '"]'));
    if(jQuery.inArray('function', event.action) > -1){
    event_targets = [ident];
    }
    }[br] });
    I found out that the attributes related to the events are different when using the Fields controls or the Form - Fields controls:
    [{"sign":"=","action":["show"],"identifier":".aClass"}...]
    {"sign":"=","value":"aValue","action":"disable_validation","identifier":"cd"}
    In the former the action is an array, in the latter it is a string.
    In the Form - Fields controls event you can select only one action at a time.
    Does that make any difference?

    maxx
    emmexx 07 Jan, 2019
    Apart from the mess my post has become after saving, now I cannot reproduce the jQuery problem. I updated my browser (firefox) and now the events are fired as expected.

    maxx
    This topic is locked and no more replies can be posted.