Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Emiel 31 posts 123 karma points
    Oct 30, 2019 @ 10:21
    Emiel
    0

    Conditional dropdown - Hide every property when not selected

    Hi!

    First of all - really cool plugin, we really needed a plugin like this for several cases.

    When using the conditional dropdown and the user has not selected the desired value from the dropdown it shouldn't let any property show specified in the datatype, because what we have now is confusing:

    enter image description here

    As you can see it shows both the properties.

  • Mario 147 posts 857 karma points MVP c-trib
    Nov 01, 2019 @ 04:18
    Mario
    0

    In this case looks pretty straight forward but what if your configurations also include hiding other properties?

    If you had an extra property that you want to show only if text boxes is selected? Even more complicated, what if you had 3 options in the dropdown and you want to show the property only if 2 of those are selected? Would you show it on load or not?

  • Rob Shaw 36 posts 169 karma points c-trib
    Nov 01, 2019 @ 09:42
    Rob Shaw
    0

    Look in the App_Plugins folder for the plugin.

    In the controller:

    Create 2 vars:

    $scope.showTextBoxes = false

    $scope.showRichTextBoxes = false

    Look for the onChange function for the drop down and set either of the above variables to true when selected.

    In the editor view

    Use the Angular "ng-if" to hide the two editors

    You might need some validation as well but without looking at the code I'm not sure.

    If you want to post the plugin controller js and the editor html I might be able to help further!

  • Mario 147 posts 857 karma points MVP c-trib
    Nov 01, 2019 @ 19:47
    Mario
    1

    I think i have an idea for a solution that can work for everyone and not just for an specific case.

    This would be allowing an empty option in the configuration, so you could choose what you want to show or hide when nothing is selected.

    I'll try to get a new release with the fix soon.

    EDIT: You can add an empty option to the configuration. To do so you have to remove the 'required' attribute form the input that sets the value in the \App_Plugins\ConditionalDisplayers\prevalueeditors\cdMultivalues.html

    <div>
      <input type="text" ng-model="item.value" val-server="item_{{$index}}" required <<<---remove that />
    </div>
    

    You will be able to create an empty option that you can configure with those values you want to hide/show if none of the other options is selected.

  • fatmazayed 4 posts 74 karma points
    1 week ago
    fatmazayed
    0

    @Mario

    it works fine without adding value

    enter image description here

    if try to add value it will not work

Please Sign in or register to post replies

Write your reply to:

Draft