Adding Another Class Toggle Deletes Previous One


#1

Wappler Version : v1.9.6
Operating System : Win 10 1809

Expected behavior

on adding a class toggle dynamic attribute when already there is a class toggle on a given element, the previously added class toggle must not be deleted.

Actual behavior

it gets deleted.

How to reproduce:

initial state:
image

add another class toggle:
image

previous one gets deleted:

manually typing it out in code view works just fine:


#2

But why are you adding the same class two times?

You just need to add it once and then add your conditions in the expression field:

Class: is-invalid
Condition: someValue == 1 || someOtherValue == 2 || someValue == 3


#3
  1. In this very case separate classes need to be applied on change of values of separate variables.
    The screenshot shows same class coz i hurriedly copy paste and share the bug report. Actually, separate classes are applied.
  2. In other cases, we may need to apply combo classes, hence need to add 2 separate class toggles. In past have used this and it was working fine.

#4

So is this happening to you only with same classes or is this also happening if you try to apply different ones?


#5

sample of when we used 2 class-toggle to apply a combo class:
image


#6

happens when we click on ‘class toggle’ and a previous one is already present. even before we enter the class name.
please refer the screenshot in first post for visual explanation.


#7

I don’t really understand the issue from your screenshots…
Can you explain what to do exactly in order to recreate it? Should I add two same classes or two different classes??


#8
  1. add a Class Toggle to a element (we’ll call it element-A). this will the first Class Toggle on the element.

  2. input the ‘class name’ you want to set and the ‘condition’.

  3. save your file.

  4. on element-A, then attempt to add another Class Toggle.

  5. when you click on the ‘Class Toggle’ item from the picker menu to add the one more ‘Class Toggle’ to element-A:
    image

  6. new Class Toggle gets added but the ‘class name’ and ‘when’ condition you had added in step 2 above is no longer visible, it is deleted.

if you add the ‘class name’ and ‘condition’ manually from the code view, it is set properly and working also properly.

same or different names of the class do not matter in the bug that we’re reporting here.


#9

Ok thanks for the explanation. We are going to check this.


assigned George #10

#11

You can’t have multiple class toggles with the same name.

So as long as the name is unique - they it should be all fine.


#12

yes.

the screenshot was a mistake - i had hardcoded from code view and shared without saving, hence it was visible.


#13

I tested this and don’t see any issue with it. I can add as many dynamic classes as i wish:

Screenshot_12


#14

well, for a fresh one, i can do it too. i just tried it.

however, for my setup it is not working.

have DM you the exact ‘input’ element am using where am getting this problem.