rsIsValid(Validation functions) and a call for contributors
Posted: Fri Feb 26, 2016 9:08 pm
Hi All,
I'm in process of creating a library extension for LC 8 that contains a set of
functions to provide data validation. I'm basing my initial set of functions on
a subset of the functions provided in ColdFusion, which I use for much of my backend development.
This extension will be available for free and under the MIT license as I’m trying to avoid any issues with including this in both the community edition as well as Indy and Business editions of LC. Source code is available on GitHub.
Validation is a very important part of ensuring the data being inputted is what is expected and preventing things like SQL injection attacks, etc. We all have our own different methods of doing validation and as with most things, some methods are better than others.
I'm putting out a call for contributors to provide their solutions to different validation types, both included and not included in the current iteration of rsIsValid.
You do not have to know anything about LiveCode Builder, you can just submit your current LiveCode Script. I will work to put it into the extension via LCB. If you do contribute code, please make sure that any needed attribution is included in your code comments.
Below is the list of functions I am currently working on as well as the link to GitHub. If you have a validation function to contribute, you can post below in this thread or fork it on GitHub. I plan to have the initial functions done, packaged and uploaded to the extension area of LiveCode by the end of next week. The development branch on GitHub is https://github.com/renegadesteve/rsIsVa ... evelopment
My hope is that we can together build a very robust library of validation tools for the entire LC community.
Best,
Steve MacLean
------------------------------------------------------------------------------------------
Initial rsIsValid functions - *Included in first release
Funtion Name (value(s)) - Description
rsIsValidCC(creditcard number) - Checks if the value is a 13-16 digit number conforming to the mod10 algorithm. Returns true if the value is or false otherwise.
rsIsValidEmail(email address) - Checks if the value is a vaild email address. Returns true if the value is or false otherwise.
rsIsValidRange(number, min, max) - Checks if the number value is between the min and max values. Returns true if the value is or false otherwise.
rsIsValidSQLDate(datetime) - Check if the value is a SQL datetime of the format yyyy-mm-dd hh:mm:ss. Returns true if the value is or false otherwise.
rsIsValidSSN(US social security number) - Checks if the value is a US Social Security Number. Returns true if the value is or false otherwise.
rsIsValidUSPhone(US telephone number) - Checks if the value is a US telephone number. Returns true if the value is or false otherwise.
rsIsValidURL(URL) Checks if value is an http, https, ftp, ftps, mailto, or news URL. Returns true if the value is or false otherwise.
rsIsValidUUID(UUID) - Checks if the value is a Universally Unique Identifier of the form "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" where ‘ X’ is a hexadecimal number. Returns true if the value is or false otherwise.
rsIsValidUSDate(US Date) - Checks to see if the value is a US Date of the format mm/dd/yyyy (hh:mm:ss), with 2 digit days and months, 4 digit years. Returns true if the value is or false otherwise.
rsIsValidUSZip(US zip code) - Checks to see if the value is a US 5- or 9-digit format ZIP code. Returns true if the value is or false otherwise.
------------------------------------------------------------------------------------------
Additional functions I would like to add/have added
rsIsValidDateTime(date-time) - Checks to see if the value is any date-time combo.
rsIsValidEuroDateTime(European formatted date-time) - Checks to see if the value is a EU formatted date-time combo.
rsIsValidUSDateTime(US formatted date-time) Checks to see if the value is a US formatted date-time combo.
Any other validation function that LC users have found they needed and want to contribute!!!!
EDIT: Removed unnecessary, duplicated functions from list
EDIT2: Updated functions and some descriptions
I'm in process of creating a library extension for LC 8 that contains a set of
functions to provide data validation. I'm basing my initial set of functions on
a subset of the functions provided in ColdFusion, which I use for much of my backend development.
This extension will be available for free and under the MIT license as I’m trying to avoid any issues with including this in both the community edition as well as Indy and Business editions of LC. Source code is available on GitHub.
Validation is a very important part of ensuring the data being inputted is what is expected and preventing things like SQL injection attacks, etc. We all have our own different methods of doing validation and as with most things, some methods are better than others.
I'm putting out a call for contributors to provide their solutions to different validation types, both included and not included in the current iteration of rsIsValid.
You do not have to know anything about LiveCode Builder, you can just submit your current LiveCode Script. I will work to put it into the extension via LCB. If you do contribute code, please make sure that any needed attribution is included in your code comments.
Below is the list of functions I am currently working on as well as the link to GitHub. If you have a validation function to contribute, you can post below in this thread or fork it on GitHub. I plan to have the initial functions done, packaged and uploaded to the extension area of LiveCode by the end of next week. The development branch on GitHub is https://github.com/renegadesteve/rsIsVa ... evelopment
My hope is that we can together build a very robust library of validation tools for the entire LC community.
Best,
Steve MacLean
------------------------------------------------------------------------------------------
Initial rsIsValid functions - *Included in first release
Funtion Name (value(s)) - Description
rsIsValidCC(creditcard number) - Checks if the value is a 13-16 digit number conforming to the mod10 algorithm. Returns true if the value is or false otherwise.
rsIsValidEmail(email address) - Checks if the value is a vaild email address. Returns true if the value is or false otherwise.
rsIsValidRange(number, min, max) - Checks if the number value is between the min and max values. Returns true if the value is or false otherwise.
rsIsValidSQLDate(datetime) - Check if the value is a SQL datetime of the format yyyy-mm-dd hh:mm:ss. Returns true if the value is or false otherwise.
rsIsValidSSN(US social security number) - Checks if the value is a US Social Security Number. Returns true if the value is or false otherwise.
rsIsValidUSPhone(US telephone number) - Checks if the value is a US telephone number. Returns true if the value is or false otherwise.
rsIsValidURL(URL) Checks if value is an http, https, ftp, ftps, mailto, or news URL. Returns true if the value is or false otherwise.
rsIsValidUUID(UUID) - Checks if the value is a Universally Unique Identifier of the form "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" where ‘ X’ is a hexadecimal number. Returns true if the value is or false otherwise.
rsIsValidUSDate(US Date) - Checks to see if the value is a US Date of the format mm/dd/yyyy (hh:mm:ss), with 2 digit days and months, 4 digit years. Returns true if the value is or false otherwise.
rsIsValidUSZip(US zip code) - Checks to see if the value is a US 5- or 9-digit format ZIP code. Returns true if the value is or false otherwise.
------------------------------------------------------------------------------------------
Additional functions I would like to add/have added
rsIsValidDateTime(date-time) - Checks to see if the value is any date-time combo.
rsIsValidEuroDateTime(European formatted date-time) - Checks to see if the value is a EU formatted date-time combo.
rsIsValidUSDateTime(US formatted date-time) Checks to see if the value is a US formatted date-time combo.
Any other validation function that LC users have found they needed and want to contribute!!!!
EDIT: Removed unnecessary, duplicated functions from list
EDIT2: Updated functions and some descriptions