Configure Input Methods

Have you ever found yourself adding an input, and while you're there,  you notice something that says “configure input”, and you've always wondered what it was? Well, today that's what we're going to cover. 

At the moment, these are only available for Text, Integer, Password, and Decimal inputs. Our core focus for this post will be Text Inputs. We’re going to look into examples of how you can implement each method and give context as to why you would opt to use them. Without wasting any more time, let’s get into it!


Starting off with the Trim method. You’ve probably seen this a lot because it is a default in the text inputs and its purpose is to get rid of any unwanted whitespace at the beginning or end of your inputs. This ensures consistency and makes sure that your values can be easily reused without worry of unwanted extra spaces. An example where having this is beneficial is when saving a user’s first and last name. Assuming you might want to create an email for the user based on those inputs, not trimming will add inconsistencies that might cause errors down the road. 

The next 2 methods are min and max; these allow you to limit the length of your input so that users don’t go beneath or beyond a certain amount of characters. Doing so will ensure that your your data is consistent and follows a strict structure before getting processed. This kind of method would be beneficial for text-based form inputs and regular inputs such as usernames and passwords. 

Next, the StartsWith method, which is where you define prefixes to the data. Using this method helps enforce a predefined pattern which reduces the risk of errors or invalid data and it provides additional information about the type or purpose of the input.. It is beneficial for inputs such as phone-numbers and unique identification fields. 

Next up is the Prevent method. Just as it suggests, this method blacklists certain words, characters or even numbers or any other unwanted content. This is beneficial for inputs such as passwords, usernames and for social media/community apps, it helps moderate content that is posted by users. 

The next 2 are upper and lower. These can be achieved inside the function stack however, you might want to apply the method directly on the input as it comes in. These allow formatting data as uppercase or lowercase and are beneficial for fields that may need to be compared or searched. In the case that your users provide their own email addresses, using the lowercase method will ensure that this data is consistent even if the user types it using different cases.

The next 3 are AlphaOK, DigiOK and OK. The AlphaOK method allows only characters from the alphabet while the DigiOK method allows only numerical characters and lastly the OK method gives you more granular control over which alphabetic and numerical characters you would like to allow. The first 2 are effective for scenarios where only numeric or alphabetic values are expected whereas the last method is effective for more restricted inputs. Examples for these could be:

AlphaOK: When saving streetnames and countries.

DigiOK: When saving phone-numbers and personal identification numbers.

OK: When saving seat numbers for theatre booking systems where there are a limited amount of seat rows and numbers. 

Lastly, We have the Pattern method. Similar to the lower and upper methods, this can be achieved in the function stack. This one allows you to define patterns for valid input. This is especially useful when you need to ensure that user-provided data adheres to a specific format, such as phone numbers, website URLs or usernames.

In conclusion, understanding and implementing various input methods plays a pivotal role in maintaining data integrity and consistency within your applications. Stay tuned for future discussions on input methods tailored for different data types, and feel free to experiment with these methods we discussed today to discover the optimal combination that suits your application's unique requirements!



PS: 

Is there a specific topic you'd like us to explore? Let us know your suggestions for future posts!

2
1 reply