Custom state shouldn't be empty

Hi everyone,

I’m struggling with my forms. I use in my forms: inputs and custom group/html elements acting as inputs. These groups/html elements are triggering workflows to store data in custom states.

I would like, as usual inputs, these groups/html elements be required. Meaning, their related custom states shouldn’t be empty to be saved. (I don’t want to use initial value to avoid that)

Have you any idea how to proceed?

Thank you :slight_smile:

Hi there, @Martino… if I understand your post correctly, you can use conditionals on elements or Only when conditions in workflows to check to see if a custom state is empty. So, for example, if you have a Save button on a page, you could set up a conditional on the button element to disable the button (i.e., make it not clickable) when a custom state associated with the page (or something on the page) is empty. If you have multiple custom states that shouldn’t be empty, you can string the conditionals together on the button element. Does that make sense, and does it sound like what you are trying to do?

Hope this helps.

Best…
Mike

Thanks @mikeloc for you answer. My message wasn’t clear. I would like to have a condition relied to my custom element “my-custom-element isn’t valid”.

For exemple with a normal input with the “shoudn’t be empty” checked: If I click my Save button, and this input doesn’t have data, this input got a “this-input isn’t valid” condition who change its color to red and not allow the Save workflow.

If a I use a “my-custom-element is empty ”, the page will load directly in red color. My problem is more about visually alert the user where is the missing data than not allowing the Save workflow.

Thank you very much :sweat_smile:

Try this…

Set a custom ‘yes/no’ state on each of the elements you want to require called something like ‘is invalid’ to signify that the data is missing (with a default value of ‘no’).

Have conditionals on those elements so that when their ‘is invalid’ state is true, the border can be red (for example).

Use an ‘only when’ condition on the ‘save’ workflow, so it will only run when all the required data is there.

Have another workflow that will run when data is missing that will set the states of the elements with missing data to ‘is invalid’ = yes.

3 Likes

Ah, okay… thanks for the clarification, and if I understand your follow-up post correctly, you can use Only when conditions in your workflow to achieve the desired result. You could have a workflow step that terminates the workflow if any required custom states are empty, and you could set another custom state prior to terminating the workflow to use as the trigger that sets a group’s borders to a certain color when a required custom state is empty. Make sense?

3 Likes

This topic was automatically closed after 70 days. New replies are no longer allowed.