I have an input box and the user can write his DOB(mm/dd/yyyy) into the box.
Before I save the data I like to test for valid input. I am using Regexlite.h and Regexlite.m.I have the regular expression too. I want to compare the regex to the user entered value in text box.But am not knowing how to do it.
Any idea how to test for a valid date? (in .NET I use a simple regex but for the iPhone sdk I am a bit helpless) - but somebody must have been done this before.
Here is a regex you can use to parse it if your looking for something else just leave me a comment
^\d{2}/\d{2}/\d{4}$
I think that you should do more validation than that---you don't want anything happening on 30 February nor allow a birth-year of 1001 and 3001 (time-travellers and Methusaleh's Children can go hang).
Perhaps someone cleverer than I could do this all with regular expressions, but I'd suggest just looking at the string and using some logic.
Why are you not using UIDatePicker to prevent user to enter your own not valid date.
Related
So I am trying to make a password validator in Scratch where it asks the user to input an answer and then it puts the answer through some criterias and then outputs if it is a valid password or not. The criterias are:
Has at least 8 characters,
Has at least one uppercase letter,
Has at least one lowercase letter,
Has at least one number,
Has at least one special character,
Must contain less than 18 characters.
I tried to make a list first with all the different characters and check if the password contained them, but it doesn't actually work. I looked all over the internet for help on this but no one seems to have done it. The Scratch Wiki does have some stuff about case sensitivity but I haven't really been able to implement it. I really need help and I have been trying for a while now. Thanks.
If you just check if the password contains the list, it will only work if it has every single character of the list in order. If you want to make sure it contains each check, you're probably going to have to make a system that checks each letter for every check, which is a little complex.
Check if <lowercase letter/whatever check> contains(letter(text reading #) of (password))
If it passes this check, continue to the next check and set text reading # to 1. Otherwise, change text reading # by 1.
I assume you'll know how to code this properly, but I just partially phrased in the way a normal human would.
This will repeat until either it reaches the end of the password or it passes the check. it will then do this again, but for a different check. It's hard to explain in text, and this is my first answer, but I hope it helps.
You have to use the operators "contains", "length of" and > operators, from the end of the class. Combine "contains", "or" and "and".
It's in ASP.NET C# programming language, I spend like 4 hours looking for solution, tried many ways but none of it works.
I have textbox which you can type in password and confirm password textbox.
I placed required field validator when user doesn't type anything to let him know he needs to type something, error pops up.
I want to have one more required field validator where it would be told to user that he needs to put 4 characters minimum in password field, if his password is less than 4 characters.
I tried every single possible way that I could come up with and stumble upon, nothing seems to be working!
You can also try DataAnnotations. apply the following lines of code to the Password property of the appropriate Class:
[Required][StringLength(MaxLength = arbitraryMaxLength, MinimumLength = 4)]
Have you tried Custom validator ?
You can do that with a RegularExpressionValidator. Maybe this helps.
guys, this is a short to the point question. Is it possible to auto add the "slashes" on a Zend_Form_Element_DateTextBox while the user is typing? For example, et say my format is dd/mm/yyyy . So the user would start typing 12 and the system would automatically add the /after it. So when typing a date you wouldn't have to add them, but simply, for example, typing 12052009 would correctly format it to 12/05/2009
No, its not. And i think this would not be a good thing to add to the dojo functionality.
What if someone wants to type 1/1/2009:
Then you automatically would get 11/20/09. You would have to have to ask the user to use zeros (01/01/2009) in some way ! Would be frustrating !
can anyone give me some idea how to write a code to display warning when users enter a value greater than the actual value, but it still can enter values for other fields. I use VB.net and access database. I think it is able to use onchange but i still don't have any idea to write the code
here is example
Use the built-in validation scheme. Example here :
http://msdn.microsoft.com/en-us/library/system.windows.data.binding.validatesondataerrors.aspx
I am creating a program and I need to validate my text boxes. For the program the user needs to put in a phrase. But I am not sure how to make sure that the user actually entered in a phrase, the phrase isn't (ex.) skldkfdl, or that there isn't a space.
Strings in Java
You could do a String.Trim() to get rid of trailing whitespaces first...
then do a String.IndexOf(" ") to check for a space.
If the function returns -1, it means there is no space in the string.
Running on the assumption that you're using VB.Net - Add an event handler for the event where you want to validate the text, such as when a "Submit" button is clicked. You may want to use a CancelEventHandler, so that you can cancel the click.
In the event handler, if you're looking for just simple validation, you can use if-statements to check some simple conditions, such as if you just want to check "if input.equals(password)".
Look here for an example of using CancelEventHandler
If you're looking for some more complex validation, you'll want to use regular expressions.
This page might help get you started
Checking to see if something is "a phrase", as in, proper English, would be very difficult. You would need to make sure that all of the words are in the dictionary, and then you would need to check for proper grammar, which is incredibly complex, given English grammar rules. You may want to simplify your approach, depending on your problem. For example, maybe just check that no weird characters are used, that there is more than one space, and that each word contains a vowel.