• bestboyfriendintheworld@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    2
    ·
    2 days ago

    people will prefix the value with “PRO#” or “#”

    Sanitizing input afterwards is a good practice and trivial for these cases. For data with a known format like here, you should always strip for example spaces in any case.

    Writing three lines of extra to allow more flexible input is easy and will make it much more user friendly. Far easier to make a software more intelligent than educate and train all users.

    • undefined@lemmy.hogru.ch
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      2 days ago

      Ha! Been there, done that. You’ll find that they’ll continue to find ways to trick the system.

      Now I get input like “*PRO”, so I have to block any string that starts with any non-alpha characters stripped + pro (case insensitive). You’d think you could just strip out all non-digits and match “pro,” but some carriers actually have letters so next you try to match any string starting with “pro” (case insensitive) after already stripping out non-alpha characters, but then you’re screwed if the string contains the letters P, R, O at all.

      It’s a cat and mouse game, but it wouldn’t have to be if people would use their brain to understand the system doesn’t need you to tell it which field you’re entering when it’s clearly labeled already—just use your brain and input the correct fucking data.

      But more to your point, you’re right. I let users input phone numbers however they damn well please and if I can’t standardize the formats and figure it out then finally I can show an error but 95% of the time that’s not the case.