Forum Discussion

RobertHarrison's avatar
RobertHarrison
Qrew Trainee
2 days ago

Validate New Drop-Down Options Before Saving

I have a drop down field that allows user to create new options, but I'd like to prevent people from adding any options with a specific key word. I thought I could accomplish this with a formula field that would just check if the drop-down field contained the key word. The problem I've run into is that it seems the formula fields are reading the new option as '_other' rather than what has been entered. I assume that is the placeholder that's used because the new option doesn't actually get saved to the drop-down field options list until the record is saved, but I cannot think of an alternative way to validate the field because of this issue.  

Here was my formula, just for reference: 
If(
    Contains([field],"Keyword"),
    Case([field],
        "Valid Option with Keyword",false,
        "Other Valid Option with Keyword",false,
        true),
    false
)

3 Replies

  • I think you're kind of mis-using the field type.

    The proper way to do this is set up a table of choices and a relationship so that one choice record has many of your detailed data entry records. Then if you allow users to add new choices, you will be on a proper form where you can have form rules or even data table rules to control what is allowed to be saved. A multiple choice field is really designed to have a few very few number of stable choices, and typically not a field where you would allow random users to add choices.

    So yes, a little more set up but a proper relationship is the way to go here. 

    • RobertHarrison's avatar
      RobertHarrison
      Qrew Trainee

      Hi Mark, I'm not sure why you think I'm mis-using the field type. Its a drop down to capture what was damaged, and although its usually one of 7 things, sometimes it can be a random item like an eaves trough that we didn't anticipate so we have to allow techs to add items on the fly. I am just trying to prevent my techs from doubling up on options that we already have, specifically one that has multiple possible names. 

      I'm hoping there is a solution that doesn't require an extra table. Just to be clear as well, this is a drop-down text field, not a multi-select field. 

      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend

        Well, Plan B would be to let them select a drop-down choice of Other and then just have a free form field which would be exposed and required by form rules where they can enter the other choice into. That way you don't clutter your main drop down field with choices that may hardly ever be used.