PricingBlog

[Solved] Class not updating from Formula

  • stockton_f-1192560824397611190

    Stockton

    2 years ago

    Hello fellow toddlers 🙂

    Am I doing something wrong? A class is not updating from a formula...

    Video -> https://share.zight.com/Z4u2xwe9
    1192560824796073984-image.png
    1
  • lucasg-1192565778545909961

    Lucas G

    2 years ago

    The "Untitled" part is the name of the class. You probably realize that but just wanted to note it
  • As for the condition, try using an equals node
  • When role equals user then it'll be true and show
  • lucasg-1192566530450407524

    Lucas G

    2 years ago

    The condition would require the output to be bool true/false
  • stockton_f-1192580544098218144

    Stockton

    2 years ago

    Hi @Lucas G Thank you so much.

    I guess I don't follow, there's no condition here.

    The class should just inherit the value of the item.role.
  • lucasg-1192580792837218435

    Lucas G

    2 years ago

    I misunderstood what you were looking to do
  • I thought you wanted the class to show when the role was user
  • What value are you looking to inherit then?
  • stockton_f-1192581092365062154

    Stockton

    2 years ago

    See the screenshot. The formula output shows "user" but the class show's undefined...
  • lucasg-1192581109133877329

    Lucas G

    2 years ago

    The condition field you showed in the video is like show/hide but for classes. It defines whether to apply them or not
  • Then to apply styles to a class, you do so from the style tab
  • stockton_f-1192581287358246924

    Stockton

    2 years ago

    Correct
  • But the output of the formula is showing undefined in the class
  • lucasg-1192581427238293534

    Lucas G

    2 years ago

    Because the output expects bool true/false
  • Apply class on true, don't apply on false
  • What exactly are you looking to do with the class?
  • stockton_f-1192581878801248347

    Stockton

    2 years ago

    That doesn't make sense to me 🤣
  • Let me record a quick video
  • lucasg-1192581965359095889

    Lucas G

    2 years ago

    Yes, please lol. I'm not following what you are trying to accomplish
  • Does this maybe help?
  • lucasg-1192583110064353341

    Lucas G

    2 years ago

    See if that video helps you out
  • stockton_f-1192583427397013584

    Stockton

    2 years ago

    Okay, I think it does...

    Let me try it.
  • I already recorded my video though so here it is... but let me try this lol https://share.zight.com/9Zu4rEro
  • lucasg-1192583894235619360

    Lucas G

    2 years ago

    1192583894063665242-image.png
  • The title is not set by the formula
  • stockton_f-1192584199690002553

    Stockton

    2 years ago

    Here is working for me now https://share.zight.com/L1uyx77x
  • lucasg-1192584227506622474

    Lucas G

    2 years ago

    What the formula does is dictate whether or not to apply the class
  • stockton_f-1192584262742978680

    Stockton

    2 years ago

    1192584262524862464-tutorialz_-_arrays_Toddle_editor_2024-01-04_at_2.44.00_PM.jpg
  • [Solved] Class not updating from Formula
  • lucasg-1192584357244833792

    Lucas G

    2 years ago

    Yeah there you go
  • stockton_f-1192584545229357187

    Stockton

    2 years ago

    Thanks Lucas!
  • There's a lot of nuances that you just have to get reps in I feel like lol
  • lucasg-1192584623780266074

    Lucas G

    2 years ago

    You might be able to set a "default" style for the chat
  • And only change it for one of them
  • Then you wouldn't need 2 classes
  • But yeah, you got it!
  • stockton_f-1192584873895010324

    Stockton

    2 years ago

    I want to use the classes to push the bot to the right side and reverse flex direction it
  • lucasg-1192584952206864495

    Lucas G

    2 years ago

    Yeah, you can do that no problem
  • stockton_f-1192585041851723897

    Stockton

    2 years ago

    Yeah, just need the right class applied 😂
  • lucasg-1192585162807054426

    Lucas G

    2 years ago

    There's 2 ways to go about it. One is to give the chat a default style which could be for the "user" bubbles for example
  • Then add a class that changes the styles when the message is from the bot
  • Or you could have 2 divs styled respectively. One which only shows for user messages and another which only shows for bot messages
  • I think the way you have it is cleaner though
  • stockton_f-1192585648406790284

    Stockton

    2 years ago

    Brilliant! Thank you! Going to poke it!