Closed BigMacAdmin closed 2 months ago
I'll have a think about how to implement this. Might be fiddly since textfields and secure fields are actually two seperate things so having an automated "validate" property might result in duplicated code but I'll have a play with it.
@BigMacAdmin How does this look?
Using the confirm
option will duplicate the textfield and the two fields need to match to pass validation. The label is the same as the parent textfield with the word "Confirm" prepended and uses the secondary font colour to distinguish it as a confirmation field and not a regular textfield.
Works for non-secure fields as well:
When used with a regex the regex checked only on the primary textfield. Since the secondary field will need to match the first anyway, any validation checks will be inherited.
This looks great, and is working perfectly in testing. You're spoiling me.
My only comment is about the potential issues with multi-lingual users (doesn't really affect me), the word "Confirm" may look out of place if the rest of the dialog is in Korean for instance. I don't know if there's a simple way to overcome that, unless you wanted to make that another configurable option (because I'm sure you want to make more configurable options, right?)
That text is localised but only to a handful of languages. Adding in other languages is easy if i know what the translations are.
That reminds me, i do need to update other areas of text since things like the error message that pops up is currently hard coded. Might make that a task to complete before release.
I didn't know you had localized support like that, thats great.
I tried again and can't seem to break this new feature, thanks again.
I do wonder if there will be some sort of "auto localisation using AI" thing for xcode announced at wwdc - for now though it's just putting strings into google translate and hoping for the best. 🙂
Is your feature request related to a problem? Please describe. Currently the best way I can figure to require the user to enter the same value in two text fields is to write a loop.
Describe the solution you'd like I would like a new
--textfield
option which would duplicate the text entry field and require the user put the same value in both textfields. This could be enforced similar to how regex is enforced, the user can't click "Ok" until the two text fields contain valid data.Possible syntax:
Describe alternatives you've considered We can create this workflow using a while loop and programming a number of attempts before erroring out the script.