Skip to main content
Question

alert on an input

  • February 28, 2024
  • 1 reply
  • 9 views

We want to make an alert within an inputbox that is related to an action (view) that leads to an increased attribute indicating that it has exceeded a maximum number of characters. Do you know how to achieve this?

1 reply

Forum|alt.badge.img+6
  • Level 0
  • March 7, 2024

Hi Maicol,

so you have an inputbox and when the input exceeds a given number of characters you want to give a warning correct?

If the warning can happen right away in the view, I would suggest you write the input from the inputbox to a runtime variable and then have a KPI checking the length of that variable, giving appropriate warnings. You can then display the KPI right next to your input box:

  1. Create Runtime variable: Name = value_box_input, the value has to be one space
  2. Create KPI in your knowledge model: Name = Value Box Check, PQL = CASE WHEN len('${{input_box_value}}') > 10 THEN 'Input to large' ELSE 'Input Valid' END
  3. Create your input box with the following yaml:

type: input-box

settings:

  type: string

  value: ""

  onChange:

    update:

      variables:

        - name: input_box_value

placeholderText: Type your input

 

Then you can place your KPI in a KPI-List component right next to your input box and see the screenshot for how it would look like:imageLet me know if that helps or if you have a question about it.

Best,

Tim