Skip to main content
May 17, 2023
Solved

Card Layout issue in Interface

  • May 17, 2023
  • 5 replies
  • 1 view

Hi All , Hope you doing  well.

 "My scenario is that I worked on a Card layout. Within the Card layout, I have some text fields. Initially, the Card layout has a predefined color. My task is to change the color of the Card layout when any value is entered into the text field. Can anyone help me out?"

    Best answer by wajahata0003

    If I understood your requirement clearly then you need to declare a local variable which by default should have some value as "ACCENT". Then use this local in the card layout style parameter. Finally in the text filed saveinto you can update the value of the local variable to the predefined accepted values of card layout style parameter.

    5 replies

    stefanhelzle0001
    Brainy
    May 17, 2023

    Well, a card layout has a style parameter which can given any color value based on any condition.

    May 17, 2023

    Well, I have already set a default color for the card, but I need to implement a condition where the card color changes when any value is entered in the text field."

    stefanhelzle0001
    Brainy
    May 17, 2023

    I do not want to be offensive, but you have a senior developer certification. Using a if() should not be a challenge to you. But maybe I am wrong and you have a more specific issue. Do you?

    wajahata0003
    May 17, 2023

    If I understood your requirement clearly then you need to declare a local variable which by default should have some value as "ACCENT". Then use this local in the card layout style parameter. Finally in the text filed saveinto you can update the value of the local variable to the predefined accepted values of card layout style parameter.

    May 18, 2023

    you can  use if condition when  u put any value in text field card style will be changed according to your condition.
    reference Code-> a!localVariables(
    local!data,
    a!cardLayout(
    contents: a!textField(
    label: "data",
    value: local!data,
    saveInto: local!data,
    ),
    style: if(isnull(local!data),"TRANSPARENT","ACCENT")
    )
    )