I have the following configuration of users. In this case, if the name is not two words, or the email is not valid, or the phone number < 10 characters, I want to flag the account as “not approved”. However, it seems to be only checking for “valid name”, and ignoring the other conditions…
An IF statement will always stop and return a result once it finds a satisfactory result. It will not continue and check all conditions unless it needs to. The IF logic in an IF column is essentially OR logic only.
Thank you. I marked it as a solution because it worked, but it showed a flaw in Glide’s ‘text length’ function. It gives a zero on my ‘word count’ function if there are no words, but ‘text length’ gives an ‘empty’ if the phone number is blank (to be consistent should give zero)…
Hi gvalero, that is great! I’ve been wondering how to do that.
Now in my sample below you can see one phone number that is valid, except there are no -dashes-.
In most languages, there is a text mask that can be applied to what the user keys in to enter the dashes for them (after the fact – not during keyin). Is there a JS plugin to accomplish that so the second phone number is considered “valid”?
Also, is there a way to stay on the edit screen if they enter an invalid phone number (do not allow submit, or if they click submit, to send them back to the screen with all existing data intact after an alert?)
Thanks. Since posting, I have had the idea to just have two JS columns, and report true if either is true. But I have also noticed that the more computed columns you have, the slower Glide is, and sometimes makes the incorrect choice on screen visibility that is based on those columns.
const r = /^([0-5]{3})?-?([0-9]{3})?-?([0-9]{4})$/;
return r.test(p1);
Also, is there a way to stay on the edit screen if they enter an invalid phone number (do not allow submit, or if they click submit, to send them back to the screen with all existing data intact after an alert?)
I’d use a Submit button ruled by a visibility condition to show/hide it if the phone format is right (RegEx JS column)