rsIsValid(Validation functions) and a call for contributors
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 36
- Joined: Fri Apr 12, 2013 9:15 pm
rsIsValid(Validation functions) and a call for contributors
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
Last edited by MadManSoft on Sun Mar 20, 2016 11:48 pm, edited 7 times in total.
-
- VIP Livecode Opensource Backer
- Posts: 7258
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: rsIsValid(Validation functions) and a call for contribut
Sounds very useful, thanks for putting this together. I will see if I have any others.
Just curious, is there a difference between your integer and array checks and the built-in LiveCode operators "is an integer" and "is an array"?
Just curious, is there a difference between your integer and array checks and the built-in LiveCode operators "is an integer" and "is an array"?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 36
- Joined: Fri Apr 12, 2013 9:15 pm
Re: rsIsValid(Validation functions) and a call for contribut
Hi Jacque,
It doesn't look like there is any difference, so I will remove those from the list along with:
Any
Binary
Boolean
Float
My goal is not to replace existing functions like those.
Thanks!
It doesn't look like there is any difference, so I will remove those from the list along with:
Any
Binary
Boolean
Float
My goal is not to replace existing functions like those.
Thanks!
-
- Posts: 36
- Joined: Fri Apr 12, 2013 9:15 pm
Re: rsIsValid(Validation functions) and a call for contribut
Hi All,
I'm please to announce the first pass of rsIsValid. It is a livecode 8 library widget. The functions in the first post are the ones currently available.
I'm also looking at include some that other folks have sent me for inclusion in the future.
If you have issues, or find a test case that doesn't work like you think it should, please let me know here.
You can download both the example file and the livecode 8 extension below, I've attached them to this post.
Also, you can find everything including the LCB source on github: https://github.com/renegadesteve/rsIsValid
If you want to add to rsIsValid please do so! This is a project for the community and community input is more than welcome!
Best,
Steve
I'm please to announce the first pass of rsIsValid. It is a livecode 8 library widget. The functions in the first post are the ones currently available.
I'm also looking at include some that other folks have sent me for inclusion in the future.
If you have issues, or find a test case that doesn't work like you think it should, please let me know here.
You can download both the example file and the livecode 8 extension below, I've attached them to this post.
Also, you can find everything including the LCB source on github: https://github.com/renegadesteve/rsIsValid
If you want to add to rsIsValid please do so! This is a project for the community and community input is more than welcome!
Best,
Steve
- Attachments
-
- rsIsValid example.livecode.zip
- rsIsValid example file
- (8.61 KiB) Downloaded 576 times
-
- community.livecode.renegadesystems.rsIsValid.0.1.0.lce.zip
- rsIsValid library extension
- (14.55 KiB) Downloaded 544 times
Re: rsIsValid(Validation functions) and a call for contribut
Hey Steve,
This looks like a really useful idea!
A quick suggestion: when you make a numbered release, why not make a release on GitHub? That way people can easily see what GitHub changes relate to which version, and also GitHub provides a convenient way to download the source code from releases.
This looks like a really useful idea!
A quick suggestion: when you make a numbered release, why not make a release on GitHub? That way people can easily see what GitHub changes relate to which version, and also GitHub provides a convenient way to download the source code from releases.
LiveCode Open Source Team — @PeterTBBrett — peter.brett@livecode.com
-
- Posts: 36
- Joined: Fri Apr 12, 2013 9:15 pm
Re: rsIsValid(Validation functions) and a call for contribut
Hi Peter,
Thanks! I hope it helps.
I've added the release on GitHub as you suggested
Thanks! I hope it helps.
I've added the release on GitHub as you suggested
Re: rsIsValid(Validation functions) and a call for contributors
Thanks for the great work and for sharing. It saved me a lot of work. Has this project evolved? I am looking for a gps coordinate validator. Regex patterns is still a step beyond me.
Oliver
Oliver
-
- Posts: 36
- Joined: Fri Apr 12, 2013 9:15 pm
Re: rsIsValid(Validation functions) and a call for contributors
Glad it helped!
It really hasn't moved forward, but that looks like an interesting addition.
Can't promise anything soon, but will look into it.
It really hasn't moved forward, but that looks like an interesting addition.
Can't promise anything soon, but will look into it.
Re: rsIsValid(Validation functions) and a call for contributors
Hi,
I gave it a try to create a gps validator, based on your other functions. It seems to work but I haven't tested all possible wrong inputs...
Let me know if you spot a mistake.
Best
Oliver
I gave it a try to create a gps validator, based on your other functions. It seems to work but I haven't tested all possible wrong inputs...
Code: Select all
function validateGPS pGPS
put "^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$" into tSchemeRegex
put matchText(pGPS, tSchemeRegex,tScheme) into validateresult
if validateresult is false then
return false
else
return true
end if
end validateGPS
Best
Oliver
Re: rsIsValid(Validation functions) and a call for contributors
Hi and thanks for what you did (and are doing?).
I am developing an App that request the user for their Email and I need to verify it (not just how is composed but also if the the mailbox exists).
I have found this FREE (up to 25 Email verification a day) service, which has an API that could, probably, be implemented in LC.
https://verifalia.com/developers
Unfortunately I am not that capable with curl, basic Auth, etc
So I wonder if someone can help me out on developing this verification that could be a nice addition to this set of functions.
I am developing an App that request the user for their Email and I need to verify it (not just how is composed but also if the the mailbox exists).
I have found this FREE (up to 25 Email verification a day) service, which has an API that could, probably, be implemented in LC.
https://verifalia.com/developers
Unfortunately I am not that capable with curl, basic Auth, etc
So I wonder if someone can help me out on developing this verification that could be a nice addition to this set of functions.
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
Re: rsIsValid(Validation functions) and a call for contributors
Before you get too carried away, trevix, you *do* know there are like, a gazillion throw away email sites out there that give you all kinds of real live email boxes that you can receive mail at, respond to it, click links from it, etc..., right? They last just long enough to 'verify' that it is an active box, then they go away.
Re: rsIsValid(Validation functions) and a call for contributors
Yes, off course.
Most users won't go in the trouble of creating a temporary email just for using an advanced part of my App.
What I am talking here is an unuttended email verification, done by my standalone.
Since I collect user emails (for newsletter, privacy statement included) using my DB server connected with the standalone, I cannot do a verification manually for each one (supposing that my standalone will have a high number of users willing to share their email).
Most users won't go in the trouble of creating a temporary email just for using an advanced part of my App.
What I am talking here is an unuttended email verification, done by my standalone.
Since I collect user emails (for newsletter, privacy statement included) using my DB server connected with the standalone, I cannot do a verification manually for each one (supposing that my standalone will have a high number of users willing to share their email).
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
Re: rsIsValid(Validation functions) and a call for contributors
Well, I'll be the first to admit I'm not using your app, so I am probably not going to fall into that 'most users' where your app pertains, but I'm not sure what you mean by creating a temp address being any kind of trouble.
For instance, you open the page here, you have an email address, it really isn't that much work. It is so little trouble I keep the page open and use it for any company that requires me to give them an email address for any reason.
However, I've derailed the topic long enough, what you do with the information above is up to you
Re: rsIsValid(Validation functions) and a call for contributors
[sorry to hijack the thread]trevix wrote: ↑Thu Mar 26, 2020 11:39 amhttps://verifalia.com/developers
Unfortunately I am not that capable with curl, basic Auth, etc
Easy.
STEP1 : create an ID for the job
Code: Select all
----- email address you want to check
put "{entries: [{ inputData: 'themail@iwantocheck.com'}]}" into tJSON
---- your verifalia username and password
set the httpHeaders to "Authorization: Basic" && base64Encode("fd1jkSSDQSKJDHQSKD:mypassword")&cr&"Content-Type: application/json"
POST tJSON to "https://api.verifalia.com/v2.1/email-validations"
put JSONToArray(it) into tArray
---this is the ID that you have just created
put tArray["overview"]["id"] into tID
STEP 2 : with the ID, fetch the result
Code: Select all
set the httpHeaders to "Authorization: Basic" && base64Encode("fd1jkSSDQSKJDHQSKD:mypassword")
put "https://api.verifalia.com/v2.1/email-validations/"&tID into tUrl
put url tUrl into tResponse
----voila : another JSON with all the data
answer tResponse
With livecode = to write a special httpheaders, before to issue your query (usually POST or GET)
Then to send a query = POST
Or GET = PUT URL tUrl into
Verifalia seems cool. You can create a free account with 25 checks per day. So it's a good way to test their API.
Re: rsIsValid(Validation functions) and a call for contributors
Thanks so much.
It is perfect. What an help!
In case some need it, see the attached stack.
It is perfect. What an help!
In case some need it, see the attached stack.
- Attachments
-
- VerifyEmail.livecode.zip
- (2.33 KiB) Downloaded 405 times
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>